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 2024-01-04 15:56:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libstorage-ng (Old) and /work/SRC/openSUSE:Factory/.libstorage-ng.new.28375 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libstorage-ng" Thu Jan 4 15:56:40 2024 rev:251 rq:1136146 version:4.5.169 Changes: -------- --- /work/SRC/openSUSE:Factory/libstorage-ng/libstorage-ng.changes 2023-12-25 19:04:56.288689768 +0100 +++ /work/SRC/openSUSE:Factory/.libstorage-ng.new.28375/libstorage-ng.changes 2024-01-04 15:57:51.865542338 +0100 @@ -1,0 +2,11 @@ +Tue Jan 2 10:55:06 UTC 2024 - aschn...@suse.com + +- merge gh#openSUSE/libstorage-ng#975 +- reduce number of udevadm settle calls during probing +- use in-class member initialization +- proved probe function taking SystemInfo as an additional argument +- fixed typos +- moved code +- 4.5.169 + +-------------------------------------------------------------------- Old: ---- libstorage-ng-4.5.168.tar.xz New: ---- libstorage-ng-4.5.169.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libstorage-ng.spec ++++++ --- /var/tmp/diff_new_pack.JiDFxn/_old 2024-01-04 15:57:52.629570249 +0100 +++ /var/tmp/diff_new_pack.JiDFxn/_new 2024-01-04 15:57:52.629570249 +0100 @@ -1,7 +1,7 @@ # # spec file for package libstorage-ng # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define libname %{name}1 Name: libstorage-ng -Version: 4.5.168 +Version: 4.5.169 Release: 0 Summary: Library for storage management License: GPL-2.0-only ++++++ libstorage-ng-4.5.168.tar.xz -> libstorage-ng-4.5.169.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/LIBVERSION new/libstorage-ng-4.5.169/LIBVERSION --- old/libstorage-ng-4.5.168/LIBVERSION 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/LIBVERSION 2024-01-02 11:55:06.000000000 +0100 @@ -1 +1 @@ -1.95.3 +1.96.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/VERSION new/libstorage-ng-4.5.169/VERSION --- old/libstorage-ng-4.5.168/VERSION 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/VERSION 2024-01-02 11:55:06.000000000 +0100 @@ -1 +1 @@ -4.5.168 +4.5.169 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/bindings/storage-catches.i new/libstorage-ng-4.5.169/bindings/storage-catches.i --- old/libstorage-ng-4.5.168/bindings/storage-catches.i 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/bindings/storage-catches.i 2024-01-02 11:55:06.000000000 +0100 @@ -428,6 +428,7 @@ %catches(storage::Exception) storage::Storage::get_system(); %catches(storage::Exception) storage::Storage::get_system() const; %catches(storage::Aborted, storage::Exception) storage::Storage::probe(const ProbeCallbacks *probe_callbacks=nullptr); +%catches(storage::Aborted, storage::Exception) storage::Storage::probe(SystemInfo &system_info, const ProbeCallbacksV3 *probe_callbacks=nullptr); %catches(storage::Exception) storage::Storage::remove_devicegraph(const std::string &name); %catches(storage::Exception) storage::Storage::remove_pool(const std::string &name); %catches(storage::Exception) storage::Storage::rename_pool(const std::string &old_name, const std::string &new_name); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/examples/compound_actions.cc new/libstorage-ng-4.5.169/examples/compound_actions.cc --- old/libstorage-ng-4.5.168/examples/compound_actions.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/examples/compound_actions.cc 2024-01-02 11:55:06.000000000 +0100 @@ -59,7 +59,7 @@ } catch (const exception& e) { - cerr << "exception occured: " << e.what() << endl; + cerr << "exception occurred: " << e.what() << endl; return EXIT_FAILURE; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/examples/create1.cc new/libstorage-ng-4.5.169/examples/create1.cc --- old/libstorage-ng-4.5.168/examples/create1.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/examples/create1.cc 2024-01-02 11:55:06.000000000 +0100 @@ -128,7 +128,7 @@ } catch (const exception& e) { - cerr << "exception occured: " << e.what() << endl; + cerr << "exception occurred: " << e.what() << endl; return EXIT_FAILURE; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/Devices/DasdPtImpl.cc new/libstorage-ng-4.5.169/storage/Devices/DasdPtImpl.cc --- old/libstorage-ng-4.5.168/storage/Devices/DasdPtImpl.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/Devices/DasdPtImpl.cc 2024-01-02 11:55:06.000000000 +0100 @@ -32,6 +32,7 @@ #include "storage/Utils/StorageDefines.h" #include "storage/Utils/AlignmentImpl.h" #include "storage/Utils/Format.h" +#include "storage/Utils/Udev.h" namespace storage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/Devices/LuksImpl.cc new/libstorage-ng-4.5.169/storage/Devices/LuksImpl.cc --- old/libstorage-ng-4.5.168/storage/Devices/LuksImpl.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/Devices/LuksImpl.cc 2024-01-02 11:55:06.000000000 +0100 @@ -501,9 +501,11 @@ void Luks::Impl::probe_uuid() { + Udevadm udevadm; + const BlkDevice* blk_device = get_blk_device(); - const Blkid& blkid(blk_device->get_name()); + const Blkid blkid(udevadm, blk_device->get_name()); Blkid::const_iterator it = blkid.get_sole_entry(); if (it != blkid.end()) uuid = it->second.luks_uuid; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/Devices/Partition.h new/libstorage-ng-4.5.169/storage/Devices/Partition.h --- old/libstorage-ng-4.5.168/storage/Devices/Partition.h 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/Devices/Partition.h 2024-01-02 11:55:06.000000000 +0100 @@ -294,7 +294,7 @@ PartitionType get_type() const; /** - * Set the partiton type. + * Set the partition type. * * @see PartitionType * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/Devices/PartitionImpl.cc new/libstorage-ng-4.5.169/storage/Devices/PartitionImpl.cc --- old/libstorage-ng-4.5.168/storage/Devices/PartitionImpl.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/Devices/PartitionImpl.cc 2024-01-02 11:55:06.000000000 +0100 @@ -25,6 +25,7 @@ #include <boost/algorithm/string.hpp> #include "storage/Utils/AppUtil.h" +#include "storage/Utils/Udev.h" #include "storage/Utils/SystemCmd.h" #include "storage/Utils/StorageDefines.h" #include "storage/Utils/StorageTmpl.h" @@ -177,8 +178,9 @@ void Partition::Impl::probe_uuid() { - const CmdUdevadmInfo& cmd_udevadm_info = CmdUdevadmInfo(get_name()); + Udevadm udevadm; + const CmdUdevadmInfo cmd_udevadm_info(udevadm, get_name()); if (!cmd_udevadm_info.get_by_partuuid_links().empty()) uuid = cmd_udevadm_info.get_by_partuuid_links().front(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/Devices/PartitionTable.h new/libstorage-ng-4.5.169/storage/Devices/PartitionTable.h --- old/libstorage-ng-4.5.168/storage/Devices/PartitionTable.h 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/Devices/PartitionTable.h 2024-01-02 11:55:06.000000000 +0100 @@ -116,14 +116,14 @@ * * Lowest number for a primary or extended partition is 1. * - * This function is independend of existing partitions. + * This function is independent of existing partitions. */ unsigned int max_primary() const; /** * Returns whether a extended partition is supported. * - * This function is independend of existing partitions. + * This function is independent of existing partitions. */ bool extended_possible() const; @@ -133,7 +133,7 @@ * * Lowest number for a logical partition is 5. * - * This function is independend of existing partitions. + * This function is independent of existing partitions. */ unsigned int max_logical() const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/Devices/PartitionTableImpl.cc new/libstorage-ng-4.5.169/storage/Devices/PartitionTableImpl.cc --- old/libstorage-ng-4.5.168/storage/Devices/PartitionTableImpl.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/Devices/PartitionTableImpl.cc 2024-01-02 11:55:06.000000000 +0100 @@ -482,7 +482,7 @@ void PartitionTable::Impl::run_dependency_manager(Actiongraph::Impl& actiongraph) { - // To speed up things this fuctions finds the actions for all + // To speed up things this functions finds the actions for all // partition tables. Going through the actions for every partition // table individually is slow. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/EtcCrypttab.cc new/libstorage-ng-4.5.169/storage/EtcCrypttab.cc --- old/libstorage-ng-4.5.168/storage/EtcCrypttab.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/EtcCrypttab.cc 2024-01-02 11:55:06.000000000 +0100 @@ -28,6 +28,7 @@ #include "storage/EtcCrypttab.h" #include "storage/Utils/LoggerImpl.h" #include "storage/Utils/StorageDefines.h" +#include "storage/Utils/Udev.h" #include "storage/SystemInfo/SystemInfoImpl.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/Filesystems/BlkFilesystemImpl.cc new/libstorage-ng-4.5.169/storage/Filesystems/BlkFilesystemImpl.cc --- old/libstorage-ng-4.5.168/storage/Filesystems/BlkFilesystemImpl.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/Filesystems/BlkFilesystemImpl.cc 2024-01-02 11:55:06.000000000 +0100 @@ -32,6 +32,7 @@ #include "storage/Utils/SystemCmd.h" #include "storage/Utils/HumanString.h" #include "storage/Utils/CallbacksImpl.h" +#include "storage/Utils/Udev.h" #include "storage/Filesystems/BlkFilesystemImpl.h" #include "storage/Filesystems/MountPointImpl.h" #include "storage/Holders/FilesystemUserImpl.h" @@ -252,9 +253,11 @@ void BlkFilesystem::Impl::probe_uuid() { + Udevadm udevadm; + const BlkDevice* blk_device = get_blk_device(); - const Blkid& blkid(blk_device->get_name()); + const Blkid blkid(udevadm, blk_device->get_name()); Blkid::const_iterator it = blkid.get_sole_entry(); if (it != blkid.end()) uuid = it->second.fs_uuid; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/Storage.cc new/libstorage-ng-4.5.169/storage/Storage.cc --- old/libstorage-ng-4.5.168/storage/Storage.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/Storage.cc 2024-01-02 11:55:06.000000000 +0100 @@ -22,6 +22,7 @@ #include "storage/StorageImpl.h" +#include "storage/SystemInfo/SystemInfo.h" namespace storage @@ -407,7 +408,16 @@ void Storage::probe(const ProbeCallbacks* probe_callbacks) { - get_impl().probe(probe_callbacks); + SystemInfo system_info; + + get_impl().probe(system_info, probe_callbacks); + } + + + void + Storage::probe(SystemInfo& system_info, const ProbeCallbacksV3* probe_callbacks) + { + get_impl().probe(system_info, probe_callbacks); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/Storage.h new/libstorage-ng-4.5.169/storage/Storage.h --- old/libstorage-ng-4.5.168/storage/Storage.h 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/Storage.h 2024-01-02 11:55:06.000000000 +0100 @@ -81,6 +81,7 @@ class Devicegraph; class Actiongraph; class Pool; + class SystemInfo; enum class PtType; enum class FsType; enum class MountByType; @@ -637,11 +638,24 @@ * If an error reported via probe_callbacks is not ignored the * function throws Aborted. * + * @see probe(SystemInfo& system_info, const ProbeCallbacks* probe_callbacks) + * * @throw Aborted, Exception */ void probe(const ProbeCallbacks* probe_callbacks = nullptr); /** + * Same as probe(const ProbeCallbacks* probe_callbacks) except for the SystemInfo + * parameter. Useful when after probing additional calls to + * BlkDevice::find_by_any_name() are used. + * + * @see probe(const ProbeCallbacks* probe_callbacks) + * + * @throw Aborted, Exception + */ + void probe(SystemInfo& system_info, const ProbeCallbacksV3* probe_callbacks = nullptr); + + /** * The actiongraph must be valid. * * If an error reported via commit_callbacks is not ignored the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/StorageImpl.cc new/libstorage-ng-4.5.169/storage/StorageImpl.cc --- old/libstorage-ng-4.5.168/storage/StorageImpl.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/StorageImpl.cc 2024-01-02 11:55:06.000000000 +0100 @@ -181,7 +181,7 @@ void - Storage::Impl::probe(const ProbeCallbacks* probe_callbacks) + Storage::Impl::probe(SystemInfo& system_info, const ProbeCallbacks* probe_callbacks) { y2mil("probe begin"); @@ -189,8 +189,6 @@ CallbacksGuard callbacks_guard(probe_callbacks); - SystemInfo system_info; - if (exist_devicegraph("probed")) remove_devicegraph("probed"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/StorageImpl.h new/libstorage-ng-4.5.169/storage/StorageImpl.h --- old/libstorage-ng-4.5.168/storage/StorageImpl.h 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/StorageImpl.h 2024-01-02 11:55:06.000000000 +0100 @@ -140,7 +140,7 @@ DeactivateStatusV2 deactivate() const; - void probe(const ProbeCallbacks* probe_callbacks); + void probe(SystemInfo& system_info, const ProbeCallbacks* probe_callbacks); void commit(const CommitOptions& commit_options, const CommitCallbacks* commit_callbacks); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/CmdBlkid.cc new/libstorage-ng-4.5.169/storage/SystemInfo/CmdBlkid.cc --- old/libstorage-ng-4.5.168/storage/SystemInfo/CmdBlkid.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/CmdBlkid.cc 2024-01-02 11:55:06.000000000 +0100 @@ -39,8 +39,10 @@ using namespace std; - Blkid::Blkid() + Blkid::Blkid(Udevadm& udevadm) { + udevadm.settle(); + SystemCmd::Options options({ BLKID_BIN, "-c", DEV_NULL_FILE }, SystemCmd::DoThrow); // If blkid does not find anything it returns 2 (see bsc #1203285). @@ -52,8 +54,10 @@ } - Blkid::Blkid(const string& device) + Blkid::Blkid(Udevadm& udevadm, const string& device) { + udevadm.settle(); + SystemCmd::Options options({ BLKID_BIN, "-c", DEV_NULL_FILE, device }, SystemCmd::DoThrow); options.verify = [](int exit_code) { return exit_code == 0 || exit_code == 2; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/CmdBlkid.h new/libstorage-ng-4.5.169/storage/SystemInfo/CmdBlkid.h --- old/libstorage-ng-4.5.168/storage/SystemInfo/CmdBlkid.h 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/CmdBlkid.h 2024-01-02 11:55:06.000000000 +0100 @@ -30,6 +30,7 @@ #include <list> #include <vector> +#include "storage/Utils/Udev.h" #include "storage/Filesystems/Filesystem.h" #include "storage/SystemInfo/SystemInfo.h" @@ -49,8 +50,8 @@ { public: - Blkid(); - Blkid(const string& device); + Blkid(Udevadm& udevadm); + Blkid(Udevadm& udevadm, const string& device); struct Entry { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/CmdBtrfs.cc new/libstorage-ng-4.5.169/storage/SystemInfo/CmdBtrfs.cc --- old/libstorage-ng-4.5.168/storage/SystemInfo/CmdBtrfs.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/CmdBtrfs.cc 2024-01-02 11:55:06.000000000 +0100 @@ -39,8 +39,10 @@ using namespace std; - CmdBtrfsFilesystemShow::CmdBtrfsFilesystemShow() + CmdBtrfsFilesystemShow::CmdBtrfsFilesystemShow(Udevadm& udevadm) { + udevadm.settle(); + SystemCmd::Options cmd_options({ BTRFS_BIN, "filesystem", "show" }, SystemCmd::DoThrow); cmd_options.verify = [](int) { return true; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/CmdBtrfs.h new/libstorage-ng-4.5.169/storage/SystemInfo/CmdBtrfs.h --- old/libstorage-ng-4.5.168/storage/SystemInfo/CmdBtrfs.h 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/CmdBtrfs.h 2024-01-02 11:55:06.000000000 +0100 @@ -33,6 +33,7 @@ #include "storage/Filesystems/Btrfs.h" #include "storage/Filesystems/BtrfsQgroupImpl.h" #include "storage/Utils/JsonFile.h" +#include "storage/Utils/Udev.h" namespace storage @@ -57,7 +58,7 @@ * * This may throw a SystemCmdException or a ParseException. */ - CmdBtrfsFilesystemShow(); + CmdBtrfsFilesystemShow(Udevadm& udevadm); /** * Device of a btrfs filesystem. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/CmdNtfsresize.cc new/libstorage-ng-4.5.169/storage/SystemInfo/CmdNtfsresize.cc --- old/libstorage-ng-4.5.168/storage/SystemInfo/CmdNtfsresize.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/CmdNtfsresize.cc 2024-01-02 11:55:06.000000000 +0100 @@ -35,7 +35,7 @@ { CmdNtfsresize::CmdNtfsresize(const string& device) - : device(device), min_size(0) + : device(device) { SystemCmd cmd({ NTFSRESIZE_BIN, "--force", "--info", device }, SystemCmd::DoThrow); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/CmdNtfsresize.h new/libstorage-ng-4.5.169/storage/SystemInfo/CmdNtfsresize.h --- old/libstorage-ng-4.5.168/storage/SystemInfo/CmdNtfsresize.h 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/CmdNtfsresize.h 2024-01-02 11:55:06.000000000 +0100 @@ -56,7 +56,7 @@ const string device; - unsigned long long min_size; + unsigned long long min_size = 0; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/CmdParted.cc new/libstorage-ng-4.5.169/storage/SystemInfo/CmdParted.cc --- old/libstorage-ng-4.5.168/storage/SystemInfo/CmdParted.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/CmdParted.cc 2024-01-02 11:55:06.000000000 +0100 @@ -42,7 +42,7 @@ using namespace std; - Parted::Parted(const string& device) + Parted::Parted(Udevadm& udevadm, const string& device) : device(device) { const bool json = PartedVersion::supports_json_option(); @@ -83,7 +83,7 @@ parse(cmd.stdout(), cmd.stderr()); if (PartedVersion::print_triggers_udev()) - udev_settle(); + udevadm.set_settle_needed(); } @@ -391,7 +391,7 @@ // TODO parted has a strange interface to represent partition type // ids. On GPT it is not possible to distinguish whether the id is - // linux or unknown. Work with upsteam parted to improve the + // linux or unknown. Work with upstream parted to improve the // interface. The line below should then be entry.id = ID_UNKNOWN entry.id = ID_LINUX; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/CmdParted.h new/libstorage-ng-4.5.169/storage/SystemInfo/CmdParted.h --- old/libstorage-ng-4.5.168/storage/SystemInfo/CmdParted.h 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/CmdParted.h 2024-01-02 11:55:06.000000000 +0100 @@ -28,6 +28,7 @@ #include "storage/Utils/Region.h" #include "storage/Utils/JsonFile.h" #include "storage/Devices/PartitionTable.h" +#include "storage/Utils/Udev.h" namespace storage @@ -50,7 +51,7 @@ * with the 'parted' command and parse its output. * This may throw a SystemCmdException or a ParseException. */ - Parted(const string& device); + Parted(Udevadm& udevadm, const string& device); /** * Entry for one partition. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/CmdResize2fs.cc new/libstorage-ng-4.5.169/storage/SystemInfo/CmdResize2fs.cc --- old/libstorage-ng-4.5.168/storage/SystemInfo/CmdResize2fs.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/CmdResize2fs.cc 2024-01-02 11:55:06.000000000 +0100 @@ -32,7 +32,7 @@ { CmdResize2fs::CmdResize2fs(const string& device) - : device(device), min_blocks(0) + : device(device) { SystemCmd cmd({ RESIZE2FS_BIN, "-P", device }, SystemCmd::DoThrow); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/CmdResize2fs.h new/libstorage-ng-4.5.169/storage/SystemInfo/CmdResize2fs.h --- old/libstorage-ng-4.5.168/storage/SystemInfo/CmdResize2fs.h 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/CmdResize2fs.h 2024-01-02 11:55:06.000000000 +0100 @@ -55,7 +55,7 @@ const string device; - unsigned long long min_blocks; + unsigned long long min_blocks = 0; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/CmdUdevadm.cc new/libstorage-ng-4.5.169/storage/SystemInfo/CmdUdevadm.cc --- old/libstorage-ng-4.5.168/storage/SystemInfo/CmdUdevadm.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/CmdUdevadm.cc 2024-01-02 11:55:06.000000000 +0100 @@ -41,15 +41,15 @@ }); - CmdUdevadmInfo::CmdUdevadmInfo(const string& file) + CmdUdevadmInfo::CmdUdevadmInfo(Udevadm& udevadm, const string& file) : file(file) { // Without emptying the udev queue 'udevadm info' can display old data // or even complain about unknown devices. Even during probing this // can happen since e.g. 'parted' opens the disk device read-write // even when all parted commands are read-only, thus triggering udev - // events (fixed in recent versions). So always run 'udevadm settle'. - udev_settle(); + // events (fixed in SUSE versions). So always run 'udevadm settle'. + udevadm.settle(); SystemCmd cmd({ UDEVADM_BIN, "info", file }, SystemCmd::DoThrow); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/CmdUdevadm.h new/libstorage-ng-4.5.169/storage/SystemInfo/CmdUdevadm.h --- old/libstorage-ng-4.5.168/storage/SystemInfo/CmdUdevadm.h 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/CmdUdevadm.h 2024-01-02 11:55:06.000000000 +0100 @@ -31,6 +31,7 @@ #include <vector> #include "storage/Utils/Enum.h" +#include "storage/Utils/Udev.h" namespace storage @@ -46,7 +47,7 @@ enum class DeviceType { UNKNOWN, DISK, PARTITION }; - CmdUdevadmInfo(const string& file); + CmdUdevadmInfo(Udevadm& udevadm, const string& file); const string& get_path() const { return path; } const string& get_name() const { return name; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/DevAndSys.cc new/libstorage-ng-4.5.169/storage/SystemInfo/DevAndSys.cc --- old/libstorage-ng-4.5.168/storage/SystemInfo/DevAndSys.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/DevAndSys.cc 2024-01-02 11:55:06.000000000 +0100 @@ -36,9 +36,11 @@ using namespace std; - Dir::Dir(const string& path) + Dir::Dir(Udevadm& udevadm, const string& path) : path(path) { + udevadm.settle(); + SystemCmd cmd({ LS_BIN, "-1", "--sort=none", path }, SystemCmd::DoThrow); parse(cmd.stdout()); @@ -156,8 +158,10 @@ map<string, string> - DevLinks::getDirLinks(const string& path) const + DevLinks::getDirLinks(Udevadm& udevadm, const string& path) const { + udevadm.settle(); + // TODO use cmd(STAT_BIN " --format '%F %N' " + path + "/*")? SystemCmd cmd({ LS_BIN, "-1l", "--sort=none", path }, SystemCmd::DoThrow); @@ -204,12 +208,12 @@ } - MdLinks::MdLinks() + MdLinks::MdLinks(Udevadm& udevadm) { map<string, string> links; try { - links = getDirLinks("/dev/md"); + links = getDirLinks(udevadm, "/dev/md"); } catch (const Exception& exception) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/DevAndSys.h new/libstorage-ng-4.5.169/storage/SystemInfo/DevAndSys.h --- old/libstorage-ng-4.5.168/storage/SystemInfo/DevAndSys.h 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/DevAndSys.h 2024-01-02 11:55:06.000000000 +0100 @@ -33,6 +33,8 @@ #include <vector> #include <map> +#include "storage/Utils/Udev.h" + namespace storage { @@ -48,7 +50,7 @@ { public: - Dir(const string& path); + Dir(Udevadm& udevadm, const string& path); typedef vector<string>::const_iterator const_iterator; @@ -115,7 +117,7 @@ protected: - map<string, string> getDirLinks(const string& path) const; + map<string, string> getDirLinks(Udevadm& udevadm, const string& path) const; map<string, string> parse(const vector<string>& lines) const; map<string, vector<string>> data; @@ -127,7 +129,7 @@ { public: - MdLinks(); + MdLinks(Udevadm& udevadm); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/SystemInfo.h new/libstorage-ng-4.5.169/storage/SystemInfo/SystemInfo.h --- old/libstorage-ng-4.5.168/storage/SystemInfo/SystemInfo.h 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/SystemInfo.h 2024-01-02 11:55:06.000000000 +0100 @@ -34,9 +34,10 @@ /** * The SystemInfo class keeps various system information. * - * So far the class can only be used for the BlkDevice::find_by_any_name() functions. - * There it can avoid querying the same information from the system several times when - * using several calls to BlkDevice::find_by_any_name(). + * So far the class can only be used for the Storage::probe() and + * BlkDevice::find_by_any_name() functions. There it can avoid querying the same + * information from the system several times when using several calls to + * BlkDevice::find_by_any_name(). */ class SystemInfo : private boost::noncopyable { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/SystemInfoImpl.cc new/libstorage-ng-4.5.169/storage/SystemInfo/SystemInfoImpl.cc --- old/libstorage-ng-4.5.168/storage/SystemInfo/SystemInfoImpl.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/SystemInfoImpl.cc 2024-01-02 11:55:06.000000000 +0100 @@ -44,7 +44,7 @@ { for (const auto& tmp : cmd_udevadm_infos.get_data()) { - // does not have an object iff the constructor throwed + // does not have an object iff the constructor threw if (!tmp.second.has_object()) continue; @@ -53,7 +53,7 @@ return cmd_udevadm_info; } - return cmd_udevadm_infos.get(file); + return cmd_udevadm_infos.get2(udevadm, file); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/SystemInfo/SystemInfoImpl.h new/libstorage-ng-4.5.169/storage/SystemInfo/SystemInfoImpl.h --- old/libstorage-ng-4.5.168/storage/SystemInfo/SystemInfoImpl.h 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/SystemInfo/SystemInfoImpl.h 2024-01-02 11:55:06.000000000 +0100 @@ -1,6 +1,6 @@ /* * Copyright (c) [2004-2015] Novell, Inc. - * Copyright (c) [2016-2023] SUSE LLC + * Copyright (c) [2016-2024] SUSE LLC * * All Rights Reserved. * @@ -29,6 +29,7 @@ #include "storage/EtcCrypttab.h" #include "storage/EtcMdadm.h" +#include "storage/Utils/Udev.h" #include "storage/SystemInfo/SystemInfo.h" #include "storage/SystemInfo/Arch.h" #include "storage/SystemInfo/ProcMounts.h" @@ -56,6 +57,7 @@ { using std::map; + /** * Encapsulates system access, also for testsuite mocking */ @@ -78,24 +80,26 @@ Impl(); ~Impl(); + Udevadm udevadm; + const EtcFstab& getEtcFstab(const string& path) { return etc_fstab.get(path); } const EtcCrypttab& getEtcCrypttab(const string& path) { return etc_crypttab.get(path); } const EtcMdadm& getEtcMdadm(const string& path) { return etc_mdadm.get(path); } const Arch& getArch() { return arch.get(); } - const Dir& getDir(const string& path) { return dirs.get(path); } + const Dir& getDir(const string& path) { return dirs.get2(udevadm, path); } const File& getFile(const string& path) { return files.get(path); } const CmdStat& getCmdStat(const string& path) { return cmd_stats.get(path); } const CmdBlockdev& getCmdBlockdev(const string& path) { return cmd_blockdev.get(path); } - const MdLinks& getMdLinks() { return md_links.get(); } + const MdLinks& getMdLinks() { return md_links.get2(udevadm); } const ProcMounts& getProcMounts() { return proc_mounts.get(); } const ProcMdstat& getProcMdstat() { return proc_mdstat.get(); } const MdadmDetail& getMdadmDetail(const string& device) { return mdadm_details.get(device); } - const Blkid& getBlkid() { return blkid.get(); } + const Blkid& getBlkid() { return blkid.get2(udevadm); } const Lsscsi& getLsscsi() { return lsscsi.get(); } const CmdNvmeList& getCmdNvmeList() { return cmd_nvme_list.get(); } const CmdNvmeListSubsys& getCmdNvmeListSubsys() { return cmd_nvme_list_subsys.get(); } - const Parted& getParted(const string& device) { return parteds.get(device); } + const Parted& getParted(const string& device) { return parteds.get2(udevadm, device); } const Dasdview& getDasdview(const string& device) { return dasdviews.get(device); } const CmdDmsetupInfo& getCmdDmsetupInfo() { return cmd_dmsetup_info.get(); } const CmdDmsetupTable& getCmdDmsetupTable() { return cmd_dmsetup_table.get(); } @@ -104,7 +108,7 @@ const CmdDmraid& getCmdDmraid() { return cmd_dmraid.get(); } const CmdMultipath& getCmdMultipath() { return cmd_multipath.get(); } - const CmdBtrfsFilesystemShow& getCmdBtrfsFilesystemShow() { return cmd_btrfs_filesystem_show.get(); } + const CmdBtrfsFilesystemShow& getCmdBtrfsFilesystemShow() { return cmd_btrfs_filesystem_show.get2(udevadm); } // The device is only used for the cache-key. const CmdBtrfsSubvolumeList& getCmdBtrfsSubvolumeList(const string& device, const string& mount_point) @@ -173,6 +177,30 @@ return *object; } + /** + * Just like get() above but also pass udevadm to constructor. + */ + const Object& get2(Udevadm& udevadm, Args... args) + { + if (ep) + std::rethrow_exception(ep); + + if (!object) + { + try + { + object = make_shared<Object>(udevadm, args...); + } + catch (const std::exception& e) + { + ep = std::current_exception(); + std::rethrow_exception(ep); + } + } + + return *object; + } + bool has_object() const { return (bool)(object); } const Object& get_object() const { return *object; } @@ -205,6 +233,14 @@ return pos->second.get(arg); } + const Object& get2(Udevadm& udevadm, const Arg& arg) + { + typename map<Arg, Helper>::iterator pos = data.lower_bound(arg); + if (pos == data.end() || typename map<Arg, Helper>::key_compare()(arg, pos->first)) + pos = data.insert(pos, typename map<Arg, Helper>::value_type(arg, Helper())); + return pos->second.get2(udevadm, arg); + } + const map<Arg, Helper>& get_data() const { return data; } private: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/Utils/AppUtil.cc new/libstorage-ng-4.5.169/storage/Utils/AppUtil.cc --- old/libstorage-ng-4.5.168/storage/Utils/AppUtil.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/Utils/AppUtil.cc 2024-01-02 11:55:06.000000000 +0100 @@ -308,61 +308,6 @@ string - udev_encode(const string& s) - { - string r = s; - - string::size_type pos = 0; - - while (true) - { - pos = r.find_first_of(" '\\/$", pos); - if (pos == string::npos) - break; - - char tmp[16]; - sprintf(tmp, "\\x%02x", r[pos]); - r.replace(pos, 1, tmp); - - pos += 4; - } - - return r; - } - - - string - udev_decode(const string& s) - { - string r = s; - - string::size_type pos = 0; - - while (true) - { - pos = r.find("\\x", pos); - if (pos == string::npos || pos > r.size() - 4) - break; - - unsigned int tmp; - if (sscanf(r.substr(pos + 2, 2).c_str(), "%x", &tmp) == 1) - r.replace(pos, 4, 1, (char) tmp); - - pos += 1; - } - - return r; - } - - - void - udev_settle() - { - SystemCmd({ UDEVADM_BIN_SETTLE }, SystemCmd::NoThrow); - } - - - string stringerror(int errnum) { #if (_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/Utils/AppUtil.h new/libstorage-ng-4.5.169/storage/Utils/AppUtil.h --- old/libstorage-ng-4.5.168/storage/Utils/AppUtil.h 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/Utils/AppUtil.h 2024-01-02 11:55:06.000000000 +0100 @@ -90,11 +90,6 @@ const string& delim = "=", const string& removeSur = " \t\n" ); - string udev_encode(const string&); - string udev_decode(const string&); - - void udev_settle(); - string normalizeDevice(const string& dev); @@ -137,7 +132,7 @@ /** - * Padding informations for NameSchema. + * Padding information for NameSchema. */ struct PadInfo { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/Utils/Makefile.am new/libstorage-ng-4.5.169/storage/Utils/Makefile.am --- old/libstorage-ng-4.5.168/storage/Utils/Makefile.am 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/Utils/Makefile.am 2024-01-02 11:55:06.000000000 +0100 @@ -8,6 +8,7 @@ Logger.h Logger.cc \ LoggerImpl.h LoggerImpl.cc \ AppUtil.cc AppUtil.h \ + Udev.cc Udev.h \ CommentedConfigFile.cc CommentedConfigFile.h \ ColumnConfigFile.cc ColumnConfigFile.h \ Diff.cc Diff.h \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/Utils/Udev.cc new/libstorage-ng-4.5.169/storage/Utils/Udev.cc --- old/libstorage-ng-4.5.168/storage/Utils/Udev.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/Utils/Udev.cc 2024-01-02 11:55:06.000000000 +0100 @@ -0,0 +1,104 @@ +/* + * Copyright (c) [2004-2015] Novell, Inc. + * Copyright (c) [2016-2024] SUSE LLC + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may + * find current contact information at www.novell.com. + */ + + +#include "storage/Utils/Udev.h" +#include "storage/Utils/SystemCmd.h" +#include "storage/Utils/StorageDefines.h" + + +namespace storage +{ + + string + udev_encode(const string& s) + { + string r = s; + + string::size_type pos = 0; + + while (true) + { + pos = r.find_first_of(" '\\/$", pos); + if (pos == string::npos) + break; + + char tmp[16]; + sprintf(tmp, "\\x%02x", r[pos]); + r.replace(pos, 1, tmp); + + pos += 4; + } + + return r; + } + + + string + udev_decode(const string& s) + { + string r = s; + + string::size_type pos = 0; + + while (true) + { + pos = r.find("\\x", pos); + if (pos == string::npos || pos > r.size() - 4) + break; + + unsigned int tmp; + if (sscanf(r.substr(pos + 2, 2).c_str(), "%x", &tmp) == 1) + r.replace(pos, 4, 1, (char) tmp); + + pos += 1; + } + + return r; + } + + + void + udev_settle() + { + SystemCmd({ UDEVADM_BIN_SETTLE }, SystemCmd::NoThrow); + } + + + void + Udevadm::settle() + { + if (settle_needed) + { + udev_settle(); + settle_needed = false; + } + } + + + void + Udevadm::set_settle_needed() + { + settle_needed = true; + } + +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/storage/Utils/Udev.h new/libstorage-ng-4.5.169/storage/Utils/Udev.h --- old/libstorage-ng-4.5.168/storage/Utils/Udev.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-ng-4.5.169/storage/Utils/Udev.h 2024-01-02 11:55:06.000000000 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright (c) [2004-2015] Novell, Inc. + * Copyright (c) [2016-2024] SUSE LLC + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may + * find current contact information at www.novell.com. + */ + + +#ifndef STORAGE_UDEV_H +#define STORAGE_UDEV_H + + +#include <string> + + +namespace storage +{ + using std::string; + + + string udev_encode(const string&); + string udev_decode(const string&); + + void udev_settle(); + + + class Udevadm + { + + public: + + void settle(); + void set_settle_needed(); + + private: + + bool settle_needed = true; + + }; + +} + + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/testsuite/SystemInfo/blkid.cc new/libstorage-ng-4.5.169/testsuite/SystemInfo/blkid.cc --- old/libstorage-ng-4.5.168/testsuite/SystemInfo/blkid.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/testsuite/SystemInfo/blkid.cc 2024-01-02 11:55:06.000000000 +0100 @@ -19,8 +19,11 @@ { Mockup::set_mode(Mockup::Mode::PLAYBACK); Mockup::set_command(BLKID_BIN " -c /dev/null", input); + Mockup::set_command({ UDEVADM_BIN_SETTLE }, {}); - Blkid blkid; + Udevadm udevadm; + + Blkid blkid(udevadm); ostringstream parsed; parsed.setf(std::ios::boolalpha); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/testsuite/SystemInfo/btrfs-filesystem-show.cc new/libstorage-ng-4.5.169/testsuite/SystemInfo/btrfs-filesystem-show.cc --- old/libstorage-ng-4.5.168/testsuite/SystemInfo/btrfs-filesystem-show.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/testsuite/SystemInfo/btrfs-filesystem-show.cc 2024-01-02 11:55:06.000000000 +0100 @@ -20,12 +20,15 @@ { Mockup::set_mode(Mockup::Mode::PLAYBACK); Mockup::set_command(BTRFS_BIN " filesystem show", input); + Mockup::set_command({ UDEVADM_BIN_SETTLE }, {}); - CmdBtrfsFilesystemShow cmdbtrfsfilesystemshow; + Udevadm udevadm; + + CmdBtrfsFilesystemShow cmd_btrfs_filesystem_show(udevadm); ostringstream parsed; parsed.setf(std::ios::boolalpha); - parsed << cmdbtrfsfilesystemshow; + parsed << cmd_btrfs_filesystem_show; string lhs = parsed.str(); string rhs; @@ -43,7 +46,9 @@ Mockup::set_mode(Mockup::Mode::PLAYBACK); Mockup::set_command(BTRFS_BIN " filesystem show", input); - BOOST_CHECK_THROW({ CmdBtrfsFilesystemShow cmdbtrfsfilesystemshow; }, ParseException); + Udevadm udevadm; + + BOOST_CHECK_THROW({ CmdBtrfsFilesystemShow cmd_btrfs_filesystem_show(udevadm); }, ParseException); } @@ -55,7 +60,9 @@ Mockup::Command command(input, stderr, 1); Mockup::set_command(BTRFS_BIN " filesystem show", command); - BOOST_CHECK_THROW({ CmdBtrfsFilesystemShow cmdbtrfsfilesystemshow; }, SystemCmdException); + Udevadm udevadm; + + BOOST_CHECK_THROW({ CmdBtrfsFilesystemShow cmd_btrfs_filesystem_show(udevadm); }, SystemCmdException); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/testsuite/SystemInfo/dir.cc new/libstorage-ng-4.5.169/testsuite/SystemInfo/dir.cc --- old/libstorage-ng-4.5.168/testsuite/SystemInfo/dir.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/testsuite/SystemInfo/dir.cc 2024-01-02 11:55:06.000000000 +0100 @@ -24,8 +24,11 @@ command.stdout = stdout; Mockup::set_command({ LS_BIN, "-1", "--sort=none", path }, command); + Mockup::set_command({ UDEVADM_BIN_SETTLE }, {}); - Dir dir(path); + Udevadm udevadm; + + Dir dir(udevadm, path); ostringstream parsed; parsed.setf(std::ios::boolalpha); @@ -59,5 +62,7 @@ Mockup::set_mode(Mockup::Mode::PLAYBACK); Mockup::set_command({ LS_BIN, "-1", "--sort=none", path }, command); - BOOST_CHECK_THROW(Dir dir(path), Exception); + Udevadm udevadm; + + BOOST_CHECK_THROW(Dir dir(udevadm, path), Exception); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/testsuite/SystemInfo/mdlinks.cc new/libstorage-ng-4.5.169/testsuite/SystemInfo/mdlinks.cc --- old/libstorage-ng-4.5.168/testsuite/SystemInfo/mdlinks.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/testsuite/SystemInfo/mdlinks.cc 2024-01-02 11:55:06.000000000 +0100 @@ -20,12 +20,15 @@ { Mockup::set_mode(Mockup::Mode::PLAYBACK); Mockup::set_command({ LS_BIN, "-1l", "--sort=none", "/dev/md" }, input); + Mockup::set_command({ UDEVADM_BIN_SETTLE }, {}); - MdLinks mdlinks; + Udevadm udevadm; + + MdLinks md_links(udevadm); ostringstream parsed; parsed.setf(std::ios::boolalpha); - parsed << mdlinks; + parsed << md_links; string lhs = parsed.str(); string rhs = accumulate(output.begin(), output.end(), ""s, @@ -40,12 +43,15 @@ Mockup::set_mode(Mockup::Mode::PLAYBACK); Mockup::Command command(input, error_input, 1); Mockup::set_command({ LS_BIN, "-1l", "--sort=none", "/dev/md" }, command); + Mockup::set_command({ UDEVADM_BIN_SETTLE }, {}); + + Udevadm udevadm; - MdLinks mdlinks; + MdLinks md_links(udevadm); ostringstream parsed; parsed.setf(std::ios::boolalpha); - parsed << mdlinks; + parsed << md_links; string lhs = parsed.str(); string rhs = accumulate(output.begin(), output.end(), ""s, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/testsuite/SystemInfo/parted-34.cc new/libstorage-ng-4.5.169/testsuite/SystemInfo/parted-34.cc --- old/libstorage-ng-4.5.168/testsuite/SystemInfo/parted-34.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/testsuite/SystemInfo/parted-34.cc 2024-01-02 11:55:06.000000000 +0100 @@ -26,7 +26,9 @@ Mockup::set_command({ PARTED_BIN, "--script", "--machine", device, "unit", "s", "print" }, RemoteCommand(stdout, stderr, 0)); - Parted parted(device); + Udevadm udevadm; + + Parted parted(udevadm, device); ostringstream parsed; parsed.setf(std::ios::boolalpha); @@ -53,7 +55,9 @@ Mockup::set_command(PARTED_BIN " --version", RemoteCommand({ "parted (GNU parted) 3.4" }, {}, 0)); Mockup::set_command({ PARTED_BIN, "--script", "--machine", device, "unit", "s", "print" }, input); - BOOST_CHECK_THROW({ Parted parted(device); }, ParseException); + Udevadm udevadm; + + BOOST_CHECK_THROW({ Parted parted(udevadm, device); }, ParseException); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/testsuite/SystemInfo/parted-35.cc new/libstorage-ng-4.5.169/testsuite/SystemInfo/parted-35.cc --- old/libstorage-ng-4.5.168/testsuite/SystemInfo/parted-35.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/testsuite/SystemInfo/parted-35.cc 2024-01-02 11:55:06.000000000 +0100 @@ -26,7 +26,9 @@ Mockup::set_command({ PARTED_BIN, "--script", "--json", device, "unit", "s", "print" }, RemoteCommand(stdout, stderr, 0)); - Parted parted(device); + Udevadm udevadm; + + Parted parted(udevadm, device); ostringstream parsed; parsed.setf(std::ios::boolalpha); @@ -53,7 +55,9 @@ Mockup::set_command(PARTED_BIN " --version", RemoteCommand({ "parted (GNU parted) 3.5" }, {}, 0)); Mockup::set_command({ PARTED_BIN, "--script", "--json", device, "unit", "s", "print" }, input); - BOOST_CHECK_THROW({ Parted parted(device); }, Exception); + Udevadm udevadm; + + BOOST_CHECK_THROW({ Parted parted(udevadm, device); }, Exception); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/testsuite/SystemInfo/udevadm-info.cc new/libstorage-ng-4.5.169/testsuite/SystemInfo/udevadm-info.cc --- old/libstorage-ng-4.5.168/testsuite/SystemInfo/udevadm-info.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/testsuite/SystemInfo/udevadm-info.cc 2024-01-02 11:55:06.000000000 +0100 @@ -22,7 +22,9 @@ Mockup::set_command({ UDEVADM_BIN_SETTLE }, {}); Mockup::set_command({ UDEVADM_BIN, "info", file }, input); - CmdUdevadmInfo cmd_udevadm_info(file); + Udevadm udevadm; + + CmdUdevadmInfo cmd_udevadm_info(udevadm, file); ostringstream parsed; parsed.setf(std::ios::boolalpha); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/testsuite/Utils/udev-encoding.cc new/libstorage-ng-4.5.169/testsuite/Utils/udev-encoding.cc --- old/libstorage-ng-4.5.168/testsuite/Utils/udev-encoding.cc 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/testsuite/Utils/udev-encoding.cc 2024-01-02 11:55:06.000000000 +0100 @@ -6,7 +6,7 @@ #include <iostream> -#include "storage/Utils/AppUtil.h" +#include "storage/Utils/Udev.h" using namespace std; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.168/testsuite/probe/nfs1-mockup.xml new/libstorage-ng-4.5.169/testsuite/probe/nfs1-mockup.xml --- old/libstorage-ng-4.5.168/testsuite/probe/nfs1-mockup.xml 2023-12-22 16:02:05.000000000 +0100 +++ new/libstorage-ng-4.5.169/testsuite/probe/nfs1-mockup.xml 2024-01-02 11:55:06.000000000 +0100 @@ -31,6 +31,9 @@ <stdout>3216071524352 1981481418752 1234590105600 nfs</stdout> </Command> <Command> + <name>/usr/bin/udevadm settle --timeout=20</name> + </Command> + <Command> <name>/usr/bin/getconf PAGESIZE</name> <stdout>4096</stdout> </Command>