Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libstorage-ng for openSUSE:Factory 
checked in at 2022-10-22 14:11:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libstorage-ng (Old)
 and      /work/SRC/openSUSE:Factory/.libstorage-ng.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libstorage-ng"

Sat Oct 22 14:11:57 2022 rev:184 rq:1029764 version:4.5.47

Changes:
--------
--- /work/SRC/openSUSE:Factory/libstorage-ng/libstorage-ng.changes      
2022-10-15 16:36:16.885983852 +0200
+++ /work/SRC/openSUSE:Factory/.libstorage-ng.new.2275/libstorage-ng.changes    
2022-10-22 14:12:00.296584133 +0200
@@ -1,0 +2,8 @@
+Tue Oct 18 13:28:26 UTC 2022 - aschn...@suse.com
+
+- merge gh#openSUSE/libstorage-ng#900
+- make result of ParitionTable::is_partition_id_supported() depend
+  on parted version
+- 4.5.47
+
+--------------------------------------------------------------------

Old:
----
  libstorage-ng-4.5.46.tar.xz

New:
----
  libstorage-ng-4.5.47.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libstorage-ng.spec ++++++
--- /var/tmp/diff_new_pack.E8UVVg/_old  2022-10-22 14:12:00.836585413 +0200
+++ /var/tmp/diff_new_pack.E8UVVg/_new  2022-10-22 14:12:00.844585432 +0200
@@ -18,7 +18,7 @@
 
 %define libname %{name}1
 Name:           libstorage-ng
-Version:        4.5.46
+Version:        4.5.47
 Release:        0
 Summary:        Library for storage management
 License:        GPL-2.0-only

++++++ libstorage-ng-4.5.46.tar.xz -> libstorage-ng-4.5.47.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.46/LIBVERSION 
new/libstorage-ng-4.5.47/LIBVERSION
--- old/libstorage-ng-4.5.46/LIBVERSION 2022-10-14 14:50:44.000000000 +0200
+++ new/libstorage-ng-4.5.47/LIBVERSION 2022-10-18 15:28:26.000000000 +0200
@@ -1 +1 @@
-1.81.0
+1.81.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.46/VERSION 
new/libstorage-ng-4.5.47/VERSION
--- old/libstorage-ng-4.5.46/VERSION    2022-10-14 14:50:44.000000000 +0200
+++ new/libstorage-ng-4.5.47/VERSION    2022-10-18 15:28:26.000000000 +0200
@@ -1 +1 @@
-4.5.46
+4.5.47
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.46/storage/Devices/GptImpl.cc 
new/libstorage-ng-4.5.47/storage/Devices/GptImpl.cc
--- old/libstorage-ng-4.5.46/storage/Devices/GptImpl.cc 2022-10-14 
14:50:44.000000000 +0200
+++ new/libstorage-ng-4.5.47/storage/Devices/GptImpl.cc 2022-10-18 
15:28:26.000000000 +0200
@@ -211,17 +211,30 @@
     Gpt::Impl::is_partition_id_supported(unsigned int id) const
     {
        static const vector<unsigned int> supported_ids = {
-           ID_UNKNOWN, ID_LINUX, ID_SWAP, ID_LVM, ID_RAID, ID_IRST, ID_ESP, 
ID_BIOS_BOOT, ID_PREP,
-           ID_WINDOWS_BASIC_DATA, ID_MICROSOFT_RESERVED, ID_DIAG, 
ID_LINUX_HOME, ID_LINUX_SERVER_DATA,
-           ID_LINUX_ROOT_ARM, ID_LINUX_ROOT_AARCH64, ID_LINUX_ROOT_PPC32, 
ID_LINUX_ROOT_PPC64BE,
-           ID_LINUX_ROOT_PPC64LE, ID_LINUX_ROOT_RISCV32, 
ID_LINUX_ROOT_RISCV64, ID_LINUX_ROOT_S390,
-           ID_LINUX_ROOT_S390X, ID_LINUX_ROOT_X86, ID_LINUX_ROOT_X86_64, 
ID_LINUX_USR_ARM,
-           ID_LINUX_USR_AARCH64, ID_LINUX_USR_PPC32, ID_LINUX_USR_PPC64BE, 
ID_LINUX_USR_PPC64LE,
-           ID_LINUX_USR_RISCV32, ID_LINUX_USR_RISCV64, ID_LINUX_USR_S390, 
ID_LINUX_USR_S390X,
-           ID_LINUX_USR_X86, ID_LINUX_USR_X86_64,
+           ID_UNKNOWN, ID_LINUX, ID_SWAP, ID_LVM, ID_RAID, ID_IRST, ID_ESP, 
ID_BIOS_BOOT,
+           ID_PREP, ID_WINDOWS_BASIC_DATA, ID_MICROSOFT_RESERVED, ID_DIAG
        };
 
-       return contains(supported_ids, id);
+       if (contains(supported_ids, id))
+           return true;
+
+       // For more ids the type command of parted 3.6 is needed.
+
+       if (!PartedVersion::supports_type_command())
+           return false;
+
+       static const vector<unsigned int> more_supported_ids = {
+           ID_LINUX_HOME, ID_LINUX_SERVER_DATA, ID_LINUX_ROOT_ARM, 
ID_LINUX_ROOT_AARCH64,
+           ID_LINUX_ROOT_PPC32, ID_LINUX_ROOT_PPC64BE, ID_LINUX_ROOT_PPC64LE,
+           ID_LINUX_ROOT_RISCV32, ID_LINUX_ROOT_RISCV64, ID_LINUX_ROOT_S390,
+           ID_LINUX_ROOT_S390X, ID_LINUX_ROOT_X86, ID_LINUX_ROOT_X86_64,
+           ID_LINUX_USR_ARM, ID_LINUX_USR_AARCH64, ID_LINUX_USR_PPC32,
+           ID_LINUX_USR_PPC64BE, ID_LINUX_USR_PPC64LE, ID_LINUX_USR_RISCV32,
+           ID_LINUX_USR_RISCV64, ID_LINUX_USR_S390, ID_LINUX_USR_S390X, 
ID_LINUX_USR_X86,
+           ID_LINUX_USR_X86_64
+       };
+
+       return contains(more_supported_ids, id);
     }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.46/storage/Devices/MsdosImpl.cc 
new/libstorage-ng-4.5.47/storage/Devices/MsdosImpl.cc
--- old/libstorage-ng-4.5.46/storage/Devices/MsdosImpl.cc       2022-10-14 
14:50:44.000000000 +0200
+++ new/libstorage-ng-4.5.47/storage/Devices/MsdosImpl.cc       2022-10-18 
15:28:26.000000000 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) [2014-2015] Novell, Inc.
- * Copyright (c) [2016-2018] SUSE LLC
+ * Copyright (c) [2016-2022] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -33,6 +33,7 @@
 #include "storage/Utils/StorageTmpl.h"
 #include "storage/Utils/XmlFile.h"
 #include "storage/Utils/Format.h"
+#include "storage/SystemInfo/CmdParted.h"
 
 
 namespace storage
@@ -160,6 +161,20 @@
     bool
     Msdos::Impl::is_partition_id_supported(unsigned int id) const
     {
+       static const vector<unsigned int> supported_ids = {
+           ID_UNKNOWN, ID_LINUX, ID_SWAP, ID_LVM, ID_RAID, ID_IRST, ID_ESP, 
ID_PREP,
+           ID_DIAG
+       };
+
+       if (contains(supported_ids, id))
+           return true;
+
+       // For more ids the type command of parted 3.6 or the old suse specific 
type flag
+       // is needed.
+
+       if (!PartedVersion::supports_type_command() && 
!PartedVersion::supports_old_type_flag())
+           return false;
+
        return id > 0 && id <= 255;
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libstorage-ng-4.5.46/storage/Devices/PartitionTable.h 
new/libstorage-ng-4.5.47/storage/Devices/PartitionTable.h
--- old/libstorage-ng-4.5.46/storage/Devices/PartitionTable.h   2022-10-14 
14:50:44.000000000 +0200
+++ new/libstorage-ng-4.5.47/storage/Devices/PartitionTable.h   2022-10-18 
15:28:26.000000000 +0200
@@ -211,6 +211,9 @@
         * This function does not consider the partition type (primary, 
extended or
         * logical) so further restriction may apply, e.g. ID_EXTENDED is not 
allowed for
         * primary partitions.
+        *
+        * Starting with libstorage-ng version 4.5.47 this function depends on 
the parted
+        * version and operating system flavour.
         */
        bool is_partition_id_supported(unsigned int id) const;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.46/storage/SystemInfo/CmdParted.cc 
new/libstorage-ng-4.5.47/storage/SystemInfo/CmdParted.cc
--- old/libstorage-ng-4.5.46/storage/SystemInfo/CmdParted.cc    2022-10-14 
14:50:44.000000000 +0200
+++ new/libstorage-ng-4.5.47/storage/SystemInfo/CmdParted.cc    2022-10-18 
15:28:26.000000000 +0200
@@ -664,23 +664,28 @@
     void
     PartedVersion::query_version()
     {
-       static bool did_query_version = false;
-
-       if (did_query_version)
+       if (did_set_version)
            return;
 
        SystemCmd cmd(PARTED_BIN " --version", SystemCmd::DoThrow);
        if (cmd.stdout().empty())
            ST_THROW(SystemCmdException(&cmd, "failed to query parted 
version"));
 
+       parse_version(cmd.stdout()[0]);
+    }
+
+
+    void
+    PartedVersion::parse_version(const string& version)
+    {
        // example versions: "3.4", "3.5", "3.5.1", "3.5.1-cec5"
        const regex version_rx("parted \\(GNU parted\\) 
([0-9]+)\\.([0-9]+)(\\.([0-9]+)(-([0-9a-z]+))?)?",
                               regex::extended);
 
        smatch match;
 
-       if (!regex_match(cmd.stdout()[0], match, version_rx))
-           ST_THROW(SystemCmdException(&cmd, "failed to parse parted 
version"));
+       if (!regex_match(version, match, version_rx))
+           ST_THROW(Exception("failed to parse parted version"));
 
        major = stoi(match[1]);
        minor = stoi(match[2]);
@@ -688,7 +693,7 @@
 
        y2mil("major:" << major << " minor:" << minor << " patchlevel:" << 
patchlevel);
 
-       did_query_version = true;
+       did_set_version = true;
     }
 
 
@@ -714,6 +719,15 @@
 
 
     bool
+    PartedVersion::supports_old_type_flag()
+    {
+       query_version();
+
+       return (major == 3 && minor < 5) && os_flavour() == OsFlavour::SUSE;
+    }
+
+
+    bool
     PartedVersion::supports_wipe_signatures()
     {
        // Option --wipesignatures is not available in upstream parted 
(2021-07-26).
@@ -740,6 +754,8 @@
     }
 
 
+    bool PartedVersion::did_set_version = false;
+
     int PartedVersion::major = 0;
     int PartedVersion::minor = 0;
     int PartedVersion::patchlevel = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.46/storage/SystemInfo/CmdParted.h 
new/libstorage-ng-4.5.47/storage/SystemInfo/CmdParted.h
--- old/libstorage-ng-4.5.46/storage/SystemInfo/CmdParted.h     2022-10-14 
14:50:44.000000000 +0200
+++ new/libstorage-ng-4.5.47/storage/SystemInfo/CmdParted.h     2022-10-18 
15:28:26.000000000 +0200
@@ -217,15 +217,19 @@
     {
     public:
 
+       static void query_version();
+       static void parse_version(const string& version);
+
        static bool supports_json_option();
        static bool supports_type_command();
+       static bool supports_old_type_flag();
        static bool supports_wipe_signatures();
        static bool supports_ignore_busy();
        static bool print_triggers_udev();
 
     private:
 
-       static void query_version();
+       static bool did_set_version;
 
        static int major;
        static int minor;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libstorage-ng-4.5.46/testsuite/partitions/attributes.cc 
new/libstorage-ng-4.5.47/testsuite/partitions/attributes.cc
--- old/libstorage-ng-4.5.46/testsuite/partitions/attributes.cc 2022-10-14 
14:50:44.000000000 +0200
+++ new/libstorage-ng-4.5.47/testsuite/partitions/attributes.cc 2022-10-18 
15:28:26.000000000 +0200
@@ -13,6 +13,7 @@
 #include "storage/Storage.h"
 #include "storage/Environment.h"
 #include "storage/Utils/Region.h"
+#include "storage/SystemInfo/CmdParted.h"
 
 
 using namespace std;
@@ -21,6 +22,8 @@
 
 BOOST_AUTO_TEST_CASE(test_attributes_on_msdos)
 {
+    PartedVersion::parse_version("parted (GNU parted) 3.5");
+
     Environment environment(true, ProbeMode::NONE, TargetMode::DIRECT);
 
     Storage storage(environment);
@@ -49,6 +52,8 @@
 
 BOOST_AUTO_TEST_CASE(test_attributes_on_gpt)
 {
+    PartedVersion::parse_version("parted (GNU parted) 3.5");
+
     Environment environment(true, ProbeMode::NONE, TargetMode::DIRECT);
 
     Storage storage(environment);
@@ -75,3 +80,25 @@
     sda1->set_legacy_boot(true);
     BOOST_CHECK(sda1->is_legacy_boot());
 }
+
+
+BOOST_AUTO_TEST_CASE(test_id_on_gpt_old_parted)
+{
+    PartedVersion::parse_version("parted (GNU parted) 3.4");
+
+    Environment environment(true, ProbeMode::NONE, TargetMode::DIRECT);
+
+    Storage storage(environment);
+
+    Devicegraph* devicegraph = storage.get_staging();
+
+    Disk* sda = Disk::create(devicegraph, "/dev/sda", Region(0, 100000, 512));
+
+    PartitionTable* gpt = sda->create_partition_table(PtType::GPT);
+
+    Partition* sda1 = gpt->create_partition("/dev/sda1", Region(1, 0, 512), 
PartitionType::PRIMARY);
+
+    sda1->set_id(ID_SWAP);
+
+    BOOST_CHECK_THROW(sda1->set_id(ID_LINUX_HOME), Exception);
+}

Reply via email to