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 2026-06-22 18:05:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libstorage-ng (Old) and /work/SRC/openSUSE:Factory/.libstorage-ng.new.1956 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libstorage-ng" Mon Jun 22 18:05:35 2026 rev:344 rq:1361071 version:4.5.334 Changes: -------- --- /work/SRC/openSUSE:Factory/libstorage-ng/libstorage-ng.changes 2026-06-15 19:41:57.583682645 +0200 +++ /work/SRC/openSUSE:Factory/.libstorage-ng.new.1956/libstorage-ng.changes 2026-06-22 18:05:59.110383346 +0200 @@ -1,0 +2,24 @@ +Mon Jun 22 10:27:15 UTC 2026 - [email protected] + +- merge gh#openSUSE/libstorage-ng#1082 +- updated swig template definitions +- 4.5.334 + +-------------------------------------------------------------------- +Fri Jun 19 12:41:33 UTC 2026 - [email protected] + +- merge gh#openSUSE/libstorage-ng#1081 +- fixed build on SLE 15 +- 4.5.333 + +-------------------------------------------------------------------- +Fri Jun 19 10:23:31 UTC 2026 - [email protected] + +- merge gh#openSUSE/libstorage-ng#1080 +- improved usleep function +- improved memory handling +- improved error reporting +- use RAII for pid of child +- 4.5.332 + +-------------------------------------------------------------------- Old: ---- libstorage-ng-4.5.331.tar.xz New: ---- libstorage-ng-4.5.334.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libstorage-ng.spec ++++++ --- /var/tmp/diff_new_pack.mnhyTp/_old 2026-06-22 18:06:01.962482858 +0200 +++ /var/tmp/diff_new_pack.mnhyTp/_new 2026-06-22 18:06:01.966482998 +0200 @@ -18,7 +18,7 @@ %define libname %{name}1 Name: libstorage-ng -Version: 4.5.331 +Version: 4.5.334 Release: 0 Summary: Library for storage management License: GPL-2.0-only @@ -62,6 +62,7 @@ BuildRequires: glibc-locale BuildRequires: libjson-c-devel %endif +BuildRequires: strace %description This package contains libstorage-ng, a library for storage management. ++++++ libstorage-ng-4.5.331.tar.xz -> libstorage-ng-4.5.334.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/.github/workflows/ci-fedora.yml new/libstorage-ng-4.5.334/.github/workflows/ci-fedora.yml --- old/libstorage-ng-4.5.331/.github/workflows/ci-fedora.yml 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/.github/workflows/ci-fedora.yml 2026-06-22 12:27:15.000000000 +0200 @@ -10,7 +10,7 @@ steps: - name: Install additional packages - run: dnf -y install autoconf automake awk boost-devel doxygen gcc-c++ gettext glibc-langpack-de git glibc-langpack-fr glibc-langpack-en graphviz json-c-devel libtool libxml2-devel make python3-devel ruby-devel rubygem-test-unit swig xz + run: dnf -y install autoconf automake awk boost-devel doxygen gcc-c++ gettext glibc-langpack-de git glibc-langpack-fr glibc-langpack-en graphviz json-c-devel libtool libxml2-devel make python3-devel ruby-devel rubygem-test-unit strace swig xz - name: List installed packages run: rpm -qa | sort diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/.github/workflows/ci-leap.yml new/libstorage-ng-4.5.334/.github/workflows/ci-leap.yml --- old/libstorage-ng-4.5.331/.github/workflows/ci-leap.yml 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/.github/workflows/ci-leap.yml 2026-06-22 12:27:15.000000000 +0200 @@ -10,7 +10,7 @@ steps: - name: Install additional packages - run: zypper --non-interactive install --no-recommends autoconf automake doxygen gcc-c++ gettext-runtime git glibc-locale graphviz libboost_headers-devel libboost_test-devel libjson-c-devel libtool libxml2-devel make python3-devel ruby-devel swig xz + run: zypper --non-interactive install --no-recommends autoconf automake doxygen gcc-c++ gettext-runtime git glibc-locale graphviz libboost_headers-devel libboost_test-devel libjson-c-devel libtool libxml2-devel make python3-devel ruby-devel strace swig xz - name: List installed packages run: rpm -qa | sort diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/.github/workflows/ci-tumbleweed.yml new/libstorage-ng-4.5.334/.github/workflows/ci-tumbleweed.yml --- old/libstorage-ng-4.5.331/.github/workflows/ci-tumbleweed.yml 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/.github/workflows/ci-tumbleweed.yml 2026-06-22 12:27:15.000000000 +0200 @@ -21,7 +21,7 @@ elif [ "${{ matrix.compiler }}" = "clang" ]; then zypper --non-interactive install --no-recommends clang fi - zypper --non-interactive install --no-recommends autoconf automake awk doxygen gettext-runtime git glibc-locale graphviz libboost_headers-devel libboost_test-devel libjson-c-devel libtool libxml2-devel make python3-devel ruby-devel swig xz + zypper --non-interactive install --no-recommends autoconf automake awk doxygen gettext-runtime git glibc-locale graphviz libboost_headers-devel libboost_test-devel libjson-c-devel libtool libxml2-devel make python3-devel ruby-devel strace swig xz - name: List installed packages run: rpm -qa | sort diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/VERSION new/libstorage-ng-4.5.334/VERSION --- old/libstorage-ng-4.5.331/VERSION 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/VERSION 2026-06-22 12:27:15.000000000 +0200 @@ -1 +1 @@ -4.5.331 +4.5.334 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/bindings/storage-template.i new/libstorage-ng-4.5.334/bindings/storage-template.i --- old/libstorage-ng-4.5.331/bindings/storage-template.i 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/bindings/storage-template.i 2026-06-22 12:27:15.000000000 +0200 @@ -115,6 +115,9 @@ %template(VectorConstDevicegraphPtr) std::vector<const Devicegraph*>; %template(MapStringConstDevicegraphPtr) std::map<std::string, const Devicegraph*>; +%template(VectorPoolPtr) std::vector<Pool*>; %template(VectorConstPoolPtr) std::vector<const Pool*>; + +%template(MapStringPoolPtr) std::map<std::string, Pool*>; %template(MapStringConstPoolPtr) std::map<std::string, const Pool*>; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/libstorage-ng.spec.in new/libstorage-ng-4.5.334/libstorage-ng.spec.in --- old/libstorage-ng-4.5.331/libstorage-ng.spec.in 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/libstorage-ng.spec.in 2026-06-22 12:27:15.000000000 +0200 @@ -62,6 +62,7 @@ BuildRequires: libjson-c-devel BuildRequires: glibc-locale %endif +BuildRequires: strace %description This package contains libstorage-ng, a library for storage management. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/storage/Devices/BlkDeviceImpl.cc new/libstorage-ng-4.5.334/storage/Devices/BlkDeviceImpl.cc --- old/libstorage-ng-4.5.331/storage/Devices/BlkDeviceImpl.cc 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/storage/Devices/BlkDeviceImpl.cc 2026-06-22 12:27:15.000000000 +0200 @@ -1043,7 +1043,7 @@ // Waits a max of 5 seconds for (int count = 0; count < 500; ++count) { - if((count % 100) == 0) + if ((count % 100) == 0) y2mil("waiting for detach " << name); usleep(10000); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/storage/Utils/AppUtil.cc new/libstorage-ng-4.5.334/storage/Utils/AppUtil.cc --- old/libstorage-ng-4.5.331/storage/Utils/AppUtil.cc 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/storage/Utils/AppUtil.cc 2026-06-22 12:27:15.000000000 +0200 @@ -100,6 +100,27 @@ } + int + usleep(useconds_t usec) + { + struct timespec duration { + .tv_sec = usec / 1000000, + .tv_nsec = (usec % 1000000) * 1000 + }; + + while (true) + { + struct timespec rem; + int ret = nanosleep(&duration, &rem); + + if (ret == -1 && errno == EINTR) + duration = rem; + else + return ret; + } + } + + string make_dev_block_name(dev_t majorminor) { @@ -115,10 +136,13 @@ glob_t globbuf; if (glob(path.c_str(), flags, 0, &globbuf) == 0) { - for (char** p = globbuf.gl_pathv; *p != 0; p++) - ret.push_back(*p); + ret.reserve(globbuf.gl_pathc); + + for (char** p = globbuf.gl_pathv; *p != 0; ++p) + ret.emplace_back(*p); + + globfree(&globbuf); } - globfree (&globbuf); return ret; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/storage/Utils/AppUtil.h new/libstorage-ng-4.5.334/storage/Utils/AppUtil.h --- old/libstorage-ng-4.5.331/storage/Utils/AppUtil.h 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/storage/Utils/AppUtil.h 2026-06-22 12:27:15.000000000 +0200 @@ -56,6 +56,11 @@ string dirname(const string& name); string basename(const string& name); + /** + * An improved usleep implementation. Takes care of EINTR. + */ + int usleep(useconds_t usec); + string make_dev_block_name(dev_t majorminor); pair<string, unsigned int> device_to_name_and_number(const string& full_name); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/storage/Utils/FileUtils.cc new/libstorage-ng-4.5.334/storage/Utils/FileUtils.cc --- old/libstorage-ng-4.5.331/storage/Utils/FileUtils.cc 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/storage/Utils/FileUtils.cc 2026-06-22 12:27:15.000000000 +0200 @@ -41,7 +41,8 @@ : path(path), name(name_template) { char* t = strdup(get_fullname().c_str()); - ST_CHECK_PTR(t); + if (!t) + ST_THROW(OutOfMemoryException()); if (mkdtemp(t) == NULL) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/storage/Utils/JsonFile.cc new/libstorage-ng-4.5.334/storage/Utils/JsonFile.cc --- old/libstorage-ng-4.5.331/storage/Utils/JsonFile.cc 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/storage/Utils/JsonFile.cc 2026-06-22 12:27:15.000000000 +0200 @@ -66,7 +66,7 @@ { root = json_tokener_parse_ex(tokener.get(), line.c_str(), line.size()); - switch (json_tokener_get_error(tokener.get())) + switch (json_tokener_error jerr = json_tokener_get_error(tokener.get())) { case json_tokener_continue: continue; @@ -75,11 +75,11 @@ return; default: - break; + ST_THROW(Exception(sformat("json parser failed: %s", json_tokener_error_desc(jerr)))); } } - ST_THROW(Exception("json parser failed")); + ST_THROW(Exception(sformat("json parser failed: runaway"))); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/storage/Utils/SystemCmd.cc new/libstorage-ng-4.5.334/storage/Utils/SystemCmd.cc --- old/libstorage-ng-4.5.331/storage/Utils/SystemCmd.cc 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/storage/Utils/SystemCmd.cc 2026-06-22 12:27:15.000000000 +0200 @@ -29,7 +29,6 @@ #include <langinfo.h> #include <sys/types.h> #include <sys/wait.h> -#include <string> #include <sstream> #include <boost/algorithm/string.hpp> @@ -323,6 +322,54 @@ int errnum = 0; }; + + /** + * RAII for pid of child. + */ + class Child : boost::noncopyable + { + public: + + ~Child() + { + if (pid != -1) + waitpid(NULL); + } + + int get_pid() const { return pid; } + + int fork(); + int waitpid(int* wstatus); + + private: + + int pid = -1; + + }; + + + int + Child::fork() + { + pid = ::fork(); + return pid; + } + + + int + Child::waitpid(int* wstatus) + { + int ret = TEMP_FAILURE_RETRY(::waitpid(pid, wstatus, 0)); + + // Since waitpid is called with options = 0 the child is dead if waitpid + // does not report an error. + + if (ret != -1) + pid = -1; + + return ret; + } + } @@ -367,7 +414,7 @@ SystemCmd& system_cmd; - pid_t child_pid = -1; + Child child; Pipe stdin_pipe; Pipe stdout_pipe; @@ -427,15 +474,16 @@ const vector<const char*> args_p(make_args()); const vector<const char*> env_p(make_env()); - child_pid = fork(); - if (child_pid == -1) + child.fork(); + if (child.get_pid() == -1) SYSCALL_FAILED("fork failed"); - if (child_pid == 0) + if (child.get_pid() == 0) { // child process - // Do not use exit() here. Use _exit() instead. + // Do not use exit() here. Use _exit() instead. Thus no destructors are + // called. // Only use async‐signal‐safe functions here, see fork(2) and // signal-safety(7). @@ -497,7 +545,7 @@ // parent process - y2mil("child_pid:" << child_pid); + y2mil("child.pid:" << child.get_pid()); if (stdin_pipe.read_end.close() != 0) SYSCALL_FAILED("close stdin in parent failed"); @@ -506,7 +554,7 @@ SYSCALL_FAILED("close stdout in parent failed"); if (stderr_pipe.write_end.close() != 0) - SYSCALL_FAILED("close stderr in parent failed" ); + SYSCALL_FAILED("close stderr in parent failed"); if (child_failure_info_pipe.write_end.close() != 0) SYSCALL_FAILED("close child_failure_info_pipe failed"); @@ -592,7 +640,7 @@ y2deb("step wait"); int wstatus; - int waitpid_ret = TEMP_FAILURE_RETRY(waitpid(child_pid, &wstatus, 0)); + int waitpid_ret = child.waitpid(&wstatus); if (waitpid_ret < 0) SYSCALL_FAILED("waitpid failed"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/testsuite/Utils/Makefile.am new/libstorage-ng-4.5.334/testsuite/Utils/Makefile.am --- old/libstorage-ng-4.5.331/testsuite/Utils/Makefile.am 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/testsuite/Utils/Makefile.am 2026-06-22 12:27:15.000000000 +0200 @@ -9,8 +9,8 @@ check_PROGRAMS = enum.test humanstring.test region.test \ exception.test topology.test alignment.test math.test systemcmd.test \ dirname.test basename.test algorithm.test format.test join.test \ - regex.test sort-by.test jsonfile.test rootprefix.test \ - udev-filters.test dm-encoding.test logger.test xml.test + regex.test sort-by.test jsonfile.test rootprefix.test glob.test \ + udev-filters.test dm-encoding.test logger.test xml.test usleep.test AM_DEFAULT_SOURCE_EXT = .cc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/testsuite/Utils/glob.cc new/libstorage-ng-4.5.334/testsuite/Utils/glob.cc --- old/libstorage-ng-4.5.331/testsuite/Utils/glob.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-ng-4.5.334/testsuite/Utils/glob.cc 2026-06-22 12:27:15.000000000 +0200 @@ -0,0 +1,47 @@ + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE libstorage + +#include <boost/test/unit_test.hpp> + +#include <glob.h> + +#include "storage/Utils/AppUtil.h" + + +using namespace std; +using namespace storage; + + +BOOST_AUTO_TEST_CASE(glob1) +{ + vector<string> tmp = glob("*.cc", GLOB_NOSORT); + + BOOST_CHECK_GT(tmp.size(), 10); + BOOST_CHECK(find(tmp.begin(), tmp.end(), "glob.cc") != tmp.end()); +} + + +BOOST_AUTO_TEST_CASE(glob2) +{ + vector<string> tmp = glob("no-no-no", 0); + + BOOST_CHECK_EQUAL(tmp.size(), 0); +} + + +BOOST_AUTO_TEST_CASE(glob3) +{ + vector<string> tmp = glob("no-no-no", GLOB_NOCHECK); + + BOOST_CHECK_EQUAL(tmp.size(), 1); + BOOST_CHECK_EQUAL(tmp[0], "no-no-no"); +} + + +BOOST_AUTO_TEST_CASE(glob_invalid_flags) +{ + vector<string> tmp = glob("*", 0xffff); + + BOOST_CHECK_EQUAL(tmp.size(), 0); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/testsuite/Utils/jsonfile.cc new/libstorage-ng-4.5.334/testsuite/Utils/jsonfile.cc --- old/libstorage-ng-4.5.331/testsuite/Utils/jsonfile.cc 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/testsuite/Utils/jsonfile.cc 2026-06-22 12:27:15.000000000 +0200 @@ -54,7 +54,9 @@ vector<string> lines = { }; - BOOST_CHECK_THROW({ JsonFile json_file(lines); }, Exception); + BOOST_CHECK_EXCEPTION({ JsonFile json_file(lines); }, Exception, [](const Exception& e) { + return strcmp(e.what(), "json parser failed: runaway") == 0; + }); } @@ -64,5 +66,19 @@ "{" }; - BOOST_CHECK_THROW({ JsonFile json_file(lines); }, Exception); + BOOST_CHECK_EXCEPTION({ JsonFile json_file(lines); }, Exception, [](const Exception& e) { + return strcmp(e.what(), "json parser failed: runaway") == 0; + }); +} + + +BOOST_AUTO_TEST_CASE(bad3) +{ + vector<string> lines = { + "{ \"fun\": true, \"tonight\": maybe }" + }; + + BOOST_CHECK_EXCEPTION({ JsonFile json_file(lines); }, Exception, [](const Exception& e) { + return strcmp(e.what(), "json parser failed: unexpected character") == 0; + }); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/testsuite/Utils/systemcmd.cc new/libstorage-ng-4.5.334/testsuite/Utils/systemcmd.cc --- old/libstorage-ng-4.5.331/testsuite/Utils/systemcmd.cc 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/testsuite/Utils/systemcmd.cc 2026-06-22 12:27:15.000000000 +0200 @@ -93,7 +93,7 @@ "stderr #2: stderr" }; - SystemCmd cmd("../helpers/echoargs_stderr hello stderr"); + SystemCmd cmd("../helpers/echoargs-stderr hello stderr"); BOOST_CHECK_EQUAL(join(cmd.stderr()),join(stderr)); BOOST_CHECK(cmd.stdout().empty()); @@ -113,7 +113,7 @@ "line #4: stderr #2: and" }; - SystemCmd cmd("../helpers/echoargs_mixed mixed to stdout and stderr"); + SystemCmd cmd("../helpers/echoargs-mixed mixed to stdout and stderr"); BOOST_CHECK_EQUAL(join(cmd.stdout()), join(stdout)); BOOST_CHECK_EQUAL(join(cmd.stderr()), join(stderr)); @@ -339,3 +339,37 @@ // same number of open fds as before BOOST_CHECK_EQUAL(num_open_fds(), n); } + + +BOOST_AUTO_TEST_CASE(fault_poll) +{ + // strace does not work in the openSUSE build service for RISC V. Never mind, two + // architectures should be enough for this test. + + // This test shows that no zombie is left if a syscall after fork fails and requires + // the waitpid in ~Child(). + +#if defined(__x86_64__) || defined(__aarch64__) + + vector<string> stdout = { + }; + + vector<string> stderr = { + "failed", + "poll failed: Cannot allocate memory", + "num children: 0" + }; + + const int n = num_open_fds(); + + SystemCmd cmd({ "strace", "-o", "/dev/null", "-e", "fault=poll,ppoll:error=ENOMEM", + "../helpers/test-systemcmd" }); + + BOOST_CHECK_EQUAL(join(cmd.stdout()), join(stdout)); + BOOST_CHECK_EQUAL(join(cmd.stderr()), join(stderr)); + BOOST_CHECK_EQUAL(cmd.retcode(), 1); + + BOOST_CHECK_EQUAL(num_open_fds(), n); + +#endif +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/testsuite/Utils/usleep.cc new/libstorage-ng-4.5.334/testsuite/Utils/usleep.cc --- old/libstorage-ng-4.5.331/testsuite/Utils/usleep.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-ng-4.5.334/testsuite/Utils/usleep.cc 2026-06-22 12:27:15.000000000 +0200 @@ -0,0 +1,41 @@ + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE libstorage + +#include <boost/test/unit_test.hpp> + +#include "storage/Utils/AppUtil.h" +#include "storage/Utils/Stopwatch.h" +#include "storage/Utils/LoggerImpl.h" + + +using namespace std; +using namespace storage; + + +BOOST_AUTO_TEST_CASE(usleep1) +{ + set_logger(get_stdout_logger()); + + Stopwatch stopwatch; + + storage::usleep(10000); + + y2mil("stopwatch " << stopwatch); + + BOOST_CHECK_GT(stopwatch.read(), 0.01); +} + + +BOOST_AUTO_TEST_CASE(usleep2) +{ + set_logger(get_stdout_logger()); + + Stopwatch stopwatch; + + storage::usleep(1020000); + + y2mil("stopwatch " << stopwatch); + + BOOST_CHECK_GT(stopwatch.read(), 1.02); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/testsuite/helpers/.gitignore new/libstorage-ng-4.5.334/testsuite/helpers/.gitignore --- old/libstorage-ng-4.5.331/testsuite/helpers/.gitignore 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/testsuite/helpers/.gitignore 2026-06-22 12:27:15.000000000 +0200 @@ -1,8 +1,9 @@ libhelpers.la *.lo echoargs -echoargs_mixed -echoargs_stderr +echoargs-mixed +echoargs-stderr repeat retcode segfaulter +test-systemcmd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/testsuite/helpers/Makefile.am new/libstorage-ng-4.5.334/testsuite/helpers/Makefile.am --- old/libstorage-ng-4.5.331/testsuite/helpers/Makefile.am 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/testsuite/helpers/Makefile.am 2026-06-22 12:27:15.000000000 +0200 @@ -11,11 +11,14 @@ noinst_PROGRAMS = \ echoargs \ - echoargs_stderr \ - echoargs_mixed \ + echoargs-stderr \ + echoargs-mixed \ repeat \ retcode \ - segfaulter + segfaulter \ + test-systemcmd AM_DEFAULT_SOURCE_EXT = .cc +test_systemcmd_LDADD = ../../storage/libstorage-ng.la +test_systemcmd_LDFLAGS = -no-install diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/testsuite/helpers/echoargs-mixed.cc new/libstorage-ng-4.5.334/testsuite/helpers/echoargs-mixed.cc --- old/libstorage-ng-4.5.331/testsuite/helpers/echoargs-mixed.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-ng-4.5.334/testsuite/helpers/echoargs-mixed.cc 2026-06-22 12:27:15.000000000 +0200 @@ -0,0 +1,24 @@ +// Output command line args alternatingly on stdout and stderr. +// This is useful for testing separating or mixing stdout and stderr in SystemCmd. + +#include <stdio.h> + +int main ( int argc, char *argv[] ) +{ + int stdout_count = 0; + int stderr_count = 0; + + for ( int i=1; i < argc; i++ ) + { + if ( i%2 == 1 ) + { + fprintf ( stdout, "line #%d: stdout #%d: %s\n", i, ++stdout_count, argv[i] ); + } + else + { + fprintf ( stderr, "line #%d: stderr #%d: %s\n", i, ++stderr_count, argv[i] ); + } + } + + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/testsuite/helpers/echoargs-stderr.cc new/libstorage-ng-4.5.334/testsuite/helpers/echoargs-stderr.cc --- old/libstorage-ng-4.5.331/testsuite/helpers/echoargs-stderr.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-ng-4.5.334/testsuite/helpers/echoargs-stderr.cc 2026-06-22 12:27:15.000000000 +0200 @@ -0,0 +1,13 @@ +// Output command line args on stderr + +#include <stdio.h> + +int main ( int argc, char *argv[] ) +{ + for ( int i=1; i < argc; i++ ) + { + fprintf ( stderr, "stderr #%d: %s\n", i, argv[i] ); + } + + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/testsuite/helpers/echoargs_mixed.cc new/libstorage-ng-4.5.334/testsuite/helpers/echoargs_mixed.cc --- old/libstorage-ng-4.5.331/testsuite/helpers/echoargs_mixed.cc 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/testsuite/helpers/echoargs_mixed.cc 1970-01-01 01:00:00.000000000 +0100 @@ -1,24 +0,0 @@ -// Output command line args alternatingly on stdout and stderr. -// This is useful for testing separating or mixing stdout and stderr in SystemCmd. - -#include <stdio.h> - -int main ( int argc, char *argv[] ) -{ - int stdout_count = 0; - int stderr_count = 0; - - for ( int i=1; i < argc; i++ ) - { - if ( i%2 == 1 ) - { - fprintf ( stdout, "line #%d: stdout #%d: %s\n", i, ++stdout_count, argv[i] ); - } - else - { - fprintf ( stderr, "line #%d: stderr #%d: %s\n", i, ++stderr_count, argv[i] ); - } - } - - return 0; -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/testsuite/helpers/echoargs_stderr.cc new/libstorage-ng-4.5.334/testsuite/helpers/echoargs_stderr.cc --- old/libstorage-ng-4.5.331/testsuite/helpers/echoargs_stderr.cc 2026-06-14 18:13:30.000000000 +0200 +++ new/libstorage-ng-4.5.334/testsuite/helpers/echoargs_stderr.cc 1970-01-01 01:00:00.000000000 +0100 @@ -1,13 +0,0 @@ -// Output command line args on stderr - -#include <stdio.h> - -int main ( int argc, char *argv[] ) -{ - for ( int i=1; i < argc; i++ ) - { - fprintf ( stderr, "stderr #%d: %s\n", i, argv[i] ); - } - - return 0; -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.331/testsuite/helpers/test-systemcmd.cc new/libstorage-ng-4.5.334/testsuite/helpers/test-systemcmd.cc --- old/libstorage-ng-4.5.331/testsuite/helpers/test-systemcmd.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-ng-4.5.334/testsuite/helpers/test-systemcmd.cc 2026-06-22 12:27:15.000000000 +0200 @@ -0,0 +1,57 @@ + +#include <iostream> + +#include "storage/Utils/SystemCmd.h" +#include "storage/Utils/Format.h" + +using namespace std; +using namespace storage; + + +unsigned int +num_children() +{ + const pid_t pid = getpid(); + + string path = sformat("/proc/%d/task/%d/children", pid, pid); + + FILE* f = fopen(path.c_str(), "r"); + if (!f) + { + cerr << "failed to open proc children file\n"; + throw; + } + + unsigned int count = 0; + + pid_t child_pid; + while (fscanf(f, "%d", &child_pid) == 1) + ++count; + + fclose(f); + + return count; +} + + +int +main() +{ + try + { + SystemCmd cmd({ "/usr/bin/echo", "hello", "world" }, SystemCmd::ThrowBehaviour::DoThrow); + } + catch (const Exception& e) + { + cerr << "failed\n" + << e.what() << '\n' + << "num children: " << num_children() << '\n'; + + return EXIT_FAILURE; + } + + cerr << "success\n" + << "num children: " << num_children() << '\n'; + + return EXIT_SUCCESS; +}
