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 2025-12-24 13:15:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libstorage-ng (Old)
 and      /work/SRC/openSUSE:Factory/.libstorage-ng.new.1928 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libstorage-ng"

Wed Dec 24 13:15:21 2025 rev:319 rq:1324186 version:4.5.281

Changes:
--------
--- /work/SRC/openSUSE:Factory/libstorage-ng/libstorage-ng.changes      
2025-12-12 21:40:40.543565304 +0100
+++ /work/SRC/openSUSE:Factory/.libstorage-ng.new.1928/libstorage-ng.changes    
2025-12-24 13:15:28.580391360 +0100
@@ -1,0 +2,8 @@
+Mon Dec 22 12:09:26 UTC 2025 - [email protected]
+
+- merge gh#openSUSE/libstorage-ng#1044
+- avoid manual memory management
+- added test case
+- 4.5.281
+
+--------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ libstorage-ng.spec ++++++
--- /var/tmp/diff_new_pack.Ezv7jI/_old  2025-12-24 13:15:29.512429739 +0100
+++ /var/tmp/diff_new_pack.Ezv7jI/_new  2025-12-24 13:15:29.516429904 +0100
@@ -18,7 +18,7 @@
 
 %define libname %{name}1
 Name:           libstorage-ng
-Version:        4.5.280
+Version:        4.5.281
 Release:        0
 Summary:        Library for storage management
 License:        GPL-2.0-only

++++++ libstorage-ng-4.5.280.tar.xz -> libstorage-ng-4.5.281.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-ng-4.5.280/VERSION 
new/libstorage-ng-4.5.281/VERSION
--- old/libstorage-ng-4.5.280/VERSION   2025-12-11 11:22:41.000000000 +0100
+++ new/libstorage-ng-4.5.281/VERSION   2025-12-22 13:09:26.000000000 +0100
@@ -1 +1 @@
-4.5.280
+4.5.281
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libstorage-ng-4.5.280/storage/SystemInfo/ProcMounts.cc 
new/libstorage-ng-4.5.281/storage/SystemInfo/ProcMounts.cc
--- old/libstorage-ng-4.5.280/storage/SystemInfo/ProcMounts.cc  2025-12-11 
11:22:41.000000000 +0100
+++ new/libstorage-ng-4.5.281/storage/SystemInfo/ProcMounts.cc  2025-12-22 
13:09:26.000000000 +0100
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) [2004-2014] Novell, Inc.
- * Copyright (c) [2016-2020] SUSE LLC
+ * Copyright (c) [2016-2025] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -27,7 +27,7 @@
 #include "storage/Utils/StorageTmpl.h"
 #include "storage/SystemInfo/SystemInfoImpl.h"
 #include "storage/Devices/BlkDeviceImpl.h"
-#include "storage/Filesystems/FilesystemImpl.h"
+#include "storage/Filesystems/Mountable.h"
 #include "storage/Utils/StorageDefines.h"
 
 
@@ -38,11 +38,11 @@
 
     ProcMounts::ProcMounts()
     {
-       AsciiFile mounts(PROC_DIR "/mounts");
-       AsciiFile swaps(PROC_DIR "/swaps");
+       const AsciiFile mounts(PROC_DIR "/mounts");
+       parse_proc_mounts(mounts.get_lines());
 
-       parse_proc_mounts_lines(mounts.get_lines());
-       parse_proc_swaps_lines(swaps.get_lines());
+       const AsciiFile swaps(PROC_DIR "/swaps");
+       parse_proc_swaps(swaps.get_lines());
 
        y2mil(*this);
     }
@@ -50,80 +50,62 @@
 
     ProcMounts::~ProcMounts()
     {
-        clear();
     }
 
 
     void
-    ProcMounts::clear()
+    ProcMounts::parse_proc_mounts(const vector<string>& lines)
     {
-       for (value_type& value : data)
-            delete value.second;
-
-        data.clear();
-    }
-
-
-    void
-    ProcMounts::parse_proc_mounts_lines(const vector<string>& lines)
-    {
-        EtcFstab fstab("");
-        fstab.parse( lines );
+       for (size_t i = 0; i < lines.size(); ++i)
+       {
+           FstabEntry entry;
+           entry.parse(lines[i]);
 
-        while ( ! fstab.empty())
-        {
-            FstabEntry * entry = dynamic_cast<FstabEntry *>( fstab.take(0) );
+           const string& spec = entry.get_spec();
+           const FsType fs_type = entry.get_fs_type();
 
-           if (entry)
+           if (boost::starts_with(spec, "/dev/") && spec != "/dev/root")
            {
-               const string& spec = entry->get_spec();
-               FsType fs_type = entry->get_fs_type();
-
-               if (boost::starts_with(spec, "/dev/") && spec != "/dev/root")
-               {
-                   data.emplace(spec, entry);
-               }
-               else if (fs_type == FsType::NFS || fs_type == FsType::NFS4 ||
-                        fs_type == FsType::TMPFS)
-               {
-                   data.emplace(spec, entry);
-               }
-               else
-               {
-                   // Get rid of all the useless stuff that clutters 
/proc/mounts
-                   delete entry;
-               }
+               data.emplace(spec, entry);
+           }
+           else if (fs_type == FsType::NFS || fs_type == FsType::NFS4 ||
+                    fs_type == FsType::TMPFS)
+           {
+               data.emplace(spec, entry);
            }
-        }
+       }
     }
 
 
     void
-    ProcMounts::parse_proc_swaps_lines(const vector<string>& lines)
+    ProcMounts::parse_proc_swaps(const vector<string>& lines)
     {
+       if (lines.empty())
+           ST_THROW(Exception("header missing in /proc/swaps"));
+
        for (size_t i = 1; i < lines.size(); ++i)
        {
            string spec = EtcFstab::decode(extractNthWord(0, lines[i]));
-
            string::size_type pos = spec.find(" (deleted)");
            if (pos != string::npos)
                spec.erase(pos);
 
-           FstabEntry* entry = new FstabEntry(spec, "swap", FsType::SWAP);
+           FstabEntry entry(spec, "swap", FsType::SWAP);
+           entry.populate_columns();   // TODO can this be made by the 
FstabEntry ctor?
+
            data.emplace(spec, entry);
        }
     }
 
 
     std::ostream&
-    operator<<(std::ostream& s, const ProcMounts& procmounts)
+    operator<<(std::ostream& s, const ProcMounts& proc_mounts)
     {
-       for (ProcMounts::const_iterator it = procmounts.data.begin(); it != 
procmounts.data.end(); ++it)
-        {
-            FstabEntry * entry = it->second;
-            entry->populate_columns();
-           s << "data[" << it->first << "] -> " << entry->format() << '\n';
-        }
+       for (const ProcMounts::value_type& tmp : proc_mounts.data)
+       {
+           FstabEntry entry = tmp.second;      // TODO make FstabEntry 
format() const
+           s << "data[" << tmp.first << "] -> " << entry.format() << '\n';
+       }
 
        return s;
     }
@@ -145,7 +127,7 @@
            if (value.first == name ||
                (BlkDevice::Impl::is_valid_name(value.first) &&
                 system_info.getCmdUdevadmInfo(value.first).get_majorminor() == 
majorminor))
-               ret.push_back(value.second);
+               ret.push_back(&value.second);
        }
 
        return ret;
@@ -159,11 +141,10 @@
 
        for (const value_type& value : data)
        {
-           if (value.second->get_fs_type() == FsType::NFS ||
-                value.second->get_fs_type() == FsType::NFS4)
-            {
-               ret.push_back(value.second);
-            }
+           const FsType fs_type = value.second.get_fs_type();
+
+           if (fs_type == FsType::NFS || fs_type == FsType::NFS4)
+               ret.push_back(&value.second);
        }
 
        return ret;
@@ -177,10 +158,10 @@
 
        for (const value_type& value : data)
        {
-           if (value.second->get_fs_type() == FsType::TMPFS)
-           {
-               ret.push_back(value.second);
-           }
+           const FsType fs_type = value.second.get_fs_type();
+
+           if (fs_type == FsType::TMPFS)
+               ret.push_back(&value.second);
        }
 
        return ret;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libstorage-ng-4.5.280/storage/SystemInfo/ProcMounts.h 
new/libstorage-ng-4.5.281/storage/SystemInfo/ProcMounts.h
--- old/libstorage-ng-4.5.280/storage/SystemInfo/ProcMounts.h   2025-12-11 
11:22:41.000000000 +0100
+++ new/libstorage-ng-4.5.281/storage/SystemInfo/ProcMounts.h   2025-12-22 
13:09:26.000000000 +0100
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) [2004-2014] Novell, Inc.
- * Copyright (c) [2016-2020] SUSE LLC
+ * Copyright (c) [2016-2025] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -47,37 +47,37 @@
        ~ProcMounts();
 
        /**
-        * Return all entries for the device. Aliases, e.g. udev
-        * symlinks, are handled by the function. This object keeps
-        * ownership of the entries; do not delete them.
+        * Return all entries for the device. Aliases, e.g. udev symlinks, are 
handled by
+        * the function.
+        *
+        * This object keeps ownership of the entries; do not delete them.
         */
        vector<const FstabEntry*> get_by_name(const string& name, 
SystemInfo::Impl& system_info) const;
 
        /**
-        * Return all NFS and NFS4 entries. This object keeps ownership of the 
entries; do
-        * not delete them.
+        * Return all NFS and NFS4 entries.
+        *
+        * This object keeps ownership of the entries; do not delete them.
         */
        vector<const FstabEntry*> get_all_nfs() const;
 
        /**
-        * Return all tmpfs entries. This object keeps ownership of the 
entries; do not
-        * delete them.
+        * Return all tmpfs entries.
+        *
+        * This object keeps ownership of the entries; do not delete them.
         */
        vector<const FstabEntry*> get_all_tmpfs() const;
 
-       friend std::ostream& operator<<(std::ostream& s, const ProcMounts& 
procmounts);
+       friend std::ostream& operator<<(std::ostream& s, const ProcMounts& 
proc_mounts);
 
     private:
 
-       void clear();
+       void parse_proc_mounts(const vector<string>& lines);
+       void parse_proc_swaps(const vector<string>& lines);
 
-       void parse_proc_mounts_lines(const vector<string>& lines);
-       void parse_proc_swaps_lines(const vector<string>& lines);
+       using value_type = multimap<string, FstabEntry>::value_type;
 
-       typedef multimap<string, FstabEntry*>::const_iterator const_iterator;
-       typedef multimap<string, FstabEntry*>::value_type value_type;
-
-       multimap<string, FstabEntry*> data;
+       multimap<string, FstabEntry> data;
 
     };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libstorage-ng-4.5.280/testsuite/SystemInfo/proc-mounts.cc 
new/libstorage-ng-4.5.281/testsuite/SystemInfo/proc-mounts.cc
--- old/libstorage-ng-4.5.280/testsuite/SystemInfo/proc-mounts.cc       
2025-12-11 11:22:41.000000000 +0100
+++ new/libstorage-ng-4.5.281/testsuite/SystemInfo/proc-mounts.cc       
2025-12-22 13:09:26.000000000 +0100
@@ -22,11 +22,11 @@
     Mockup::set_file("/proc/mounts", input_mount);
     Mockup::set_file("/proc/swaps", input_swap);
 
-    ProcMounts procmounts;
+    ProcMounts proc_mounts;
 
     ostringstream parsed;
     parsed.setf(std::ios::boolalpha);
-    parsed << procmounts;
+    parsed << proc_mounts;
 
     string actual_str = parsed.str();
     vector<string> actual_lines;
@@ -137,4 +137,23 @@
     };
 
     check(input_mount, input_swap, output);
+}
+
+
+BOOST_AUTO_TEST_CASE(parse3)
+{
+    vector<string> input_mount = {
+    };
+
+    vector<string> input_swap = {
+       "Filename                               Type            Size            
Used            Priority",
+       "/dev/sda3\\040(deleted)                  partition     2098152         
0               -2"
+    };
+
+    vector<string> output = {
+       "data[/dev/sda3] -> /dev/sda3  swap  swap  defaults  0  0",
+       ""
+    };
+
+    check(input_mount, input_swap, output);
 }

Reply via email to