Hello community, here is the log from the commit of package libstorage-ng for openSUSE:Factory checked in at 2018-09-10 12:36:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libstorage-ng (Old) and /work/SRC/openSUSE:Factory/.libstorage-ng.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libstorage-ng" Mon Sep 10 12:36:23 2018 rev:33 rq:633701 version:4.1.24 Changes: -------- --- /work/SRC/openSUSE:Factory/libstorage-ng/libstorage-ng.changes 2018-09-04 22:51:30.964045068 +0200 +++ /work/SRC/openSUSE:Factory/.libstorage-ng.new/libstorage-ng.changes 2018-09-10 12:36:25.938240365 +0200 @@ -1,0 +2,16 @@ +Thu Sep 6 09:30:54 UTC 2018 - aschn...@suse.com + +- merge gh#openSUSE/libstorage-ng#568 +- avoid setenv after fork (bsc#1107403) +- added unit test +- 4.1.24 + +-------------------------------------------------------------------- +Wed Sep 5 14:11:44 UTC 2018 - aschn...@suse.com + +- merge gh#openSUSE/libstorage-ng#567 +- added luks label to blkid parser +- added unit test +- 4.1.23 + +-------------------------------------------------------------------- Old: ---- libstorage-ng-4.1.22.tar.xz New: ---- libstorage-ng-4.1.24.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libstorage-ng.spec ++++++ --- /var/tmp/diff_new_pack.9nD09E/_old 2018-09-10 12:36:26.350239756 +0200 +++ /var/tmp/diff_new_pack.9nD09E/_new 2018-09-10 12:36:26.354239750 +0200 @@ -18,7 +18,7 @@ %define libname %{name}1 Name: libstorage-ng -Version: 4.1.22 +Version: 4.1.24 Release: 0 Summary: Library for storage management License: GPL-2.0-only ++++++ libstorage-ng-4.1.22.tar.xz -> libstorage-ng-4.1.24.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.1.22/VERSION new/libstorage-ng-4.1.24/VERSION --- old/libstorage-ng-4.1.22/VERSION 2018-09-02 14:01:32.000000000 +0200 +++ new/libstorage-ng-4.1.24/VERSION 2018-09-06 11:30:54.000000000 +0200 @@ -1 +1 @@ -4.1.22 +4.1.24 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.1.22/storage/SystemInfo/CmdBlkid.cc new/libstorage-ng-4.1.24/storage/SystemInfo/CmdBlkid.cc --- old/libstorage-ng-4.1.22/storage/SystemInfo/CmdBlkid.cc 2018-09-02 14:01:32.000000000 +0200 +++ new/libstorage-ng-4.1.24/storage/SystemInfo/CmdBlkid.cc 2018-09-06 11:30:54.000000000 +0200 @@ -1,6 +1,6 @@ /* * Copyright (c) [2004-2014] Novell, Inc. - * Copyright (c) [2016-2017] SUSE LLC + * Copyright (c) [2016-2018] SUSE LLC * * All Rights Reserved. * @@ -127,6 +127,10 @@ it1 = m.find("UUID"); if (it1 != m.end()) entry.luks_uuid = it1->second; + + it1 = m.find("LABEL"); + if (it1 != m.end()) + entry.luks_label = it1->second; } if (entry.is_bcache) @@ -250,6 +254,8 @@ s << "is-luks:" << entry.is_luks; if (!entry.luks_uuid.empty()) s << " luks-uuid:" << entry.luks_uuid; + if (!entry.luks_label.empty()) + s << " luks-label:" << entry.luks_label; } if (entry.is_bcache) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.1.22/storage/SystemInfo/CmdBlkid.h new/libstorage-ng-4.1.24/storage/SystemInfo/CmdBlkid.h --- old/libstorage-ng-4.1.22/storage/SystemInfo/CmdBlkid.h 2018-09-02 14:01:32.000000000 +0200 +++ new/libstorage-ng-4.1.24/storage/SystemInfo/CmdBlkid.h 2018-09-06 11:30:54.000000000 +0200 @@ -1,6 +1,6 @@ /* * Copyright (c) [2004-2014] Novell, Inc. - * Copyright (c) [2016-2017] SUSE LLC + * Copyright (c) [2016-2018] SUSE LLC * * All Rights Reserved. * @@ -56,7 +56,7 @@ { Entry() : is_fs(false), fs_type(FsType::UNKNOWN), fs_uuid(), fs_label(), fs_journal_uuid(), is_journal(false), journal_uuid(), is_md(false), is_lvm(false), - is_luks(false), luks_uuid(), is_bcache(false), bcache_uuid() {} + is_luks(false), luks_uuid(), luks_label(), is_bcache(false), bcache_uuid() {} bool is_fs; FsType fs_type; @@ -73,6 +73,7 @@ bool is_luks; string luks_uuid; + string luks_label; bool is_bcache; string bcache_uuid; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.1.22/storage/Utils/SystemCmd.cc new/libstorage-ng-4.1.24/storage/Utils/SystemCmd.cc --- old/libstorage-ng-4.1.22/storage/Utils/SystemCmd.cc 2018-09-02 14:01:32.000000000 +0200 +++ new/libstorage-ng-4.1.24/storage/Utils/SystemCmd.cc 2018-09-06 11:30:54.000000000 +0200 @@ -32,6 +32,8 @@ #include <sstream> #include <boost/algorithm/string.hpp> +extern char **environ; + #include "storage/Utils/ExceptionImpl.h" #include "storage/Utils/Stopwatch.h" #include "storage/Utils/LoggerImpl.h" @@ -324,11 +326,12 @@ } } y2deb("sout:" << _pfds[1].fd << " serr:" << (_combineOutput?-1:_pfds[2].fd)); + + const vector<const char*> env = make_env(); + switch( (_cmdPid=fork()) ) { case 0: // child process - setenv( "LC_ALL", "C", 1 ); - setenv( "LANGUAGE", "C", 1 ); if ( dup2( sin[0], STDIN_FILENO )<0 ) { @@ -359,13 +362,13 @@ SYSCALL_FAILED_NOTHROW( "close( stderr ) failed in child process" ); } closeOpenFds(); - _cmdRet = execl(SHBIN, SHBIN, "-c", command().c_str(), nullptr); + _cmdRet = execle(SHBIN, SHBIN, "-c", command().c_str(), nullptr, &env[0]); - // execl() should not return. If we get here, it failed. + // execle() should not return. If we get here, it failed. // Throwing an exception here would not make any sense, however: // We are in the forked child process, and there is nothing // to return to that could make use of an exception. - y2err("execl() failed: THIS SHOULD NOT HAPPEN \"SHBIN\" Ret:" << + y2err("execle() failed: THIS SHOULD NOT HAPPEN \"SHBIN\" Ret:" << _cmdRet << " errno: " << errno); y2err( "Exiting child process" ); exit(127); // same as "command not found" in the shell @@ -707,6 +710,27 @@ } + vector<const char*> + SystemCmd::make_env() const + { + vector<const char*> env; + + for (char** v = environ; *v != NULL; ++v) + { + if (strncmp(*v, "LC_ALL=", strlen("LC_ALL=")) != 0 && + strncmp(*v, "LANGUAGE=", strlen("LANGUAGE=")) != 0) + env.push_back(*v); + } + + env.push_back("LC_ALL=C"); + env.push_back("LANGUAGE=C"); + + env.push_back(nullptr); + + return env; + } + + string SystemCmd::quote(const string& str) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.1.22/storage/Utils/SystemCmd.h new/libstorage-ng-4.1.24/storage/Utils/SystemCmd.h --- old/libstorage-ng-4.1.22/storage/Utils/SystemCmd.h 2018-09-02 14:01:32.000000000 +0200 +++ new/libstorage-ng-4.1.24/storage/Utils/SystemCmd.h 2018-09-06 11:30:54.000000000 +0200 @@ -231,6 +231,16 @@ static bool _testmode; + /** + * Constructs the environment for the child process. + * + * Must not be called after exec since allocating the memory + * for the vector is not allowed then (in a multithreaded + * program), see fork(2) and signal-safety(7). So simply call + * it right before fork. + */ + vector<const char*> make_env() const; + }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.1.22/testsuite/SystemInfo/blkid.cc new/libstorage-ng-4.1.24/testsuite/SystemInfo/blkid.cc --- old/libstorage-ng-4.1.22/testsuite/SystemInfo/blkid.cc 2018-09-02 14:01:32.000000000 +0200 +++ new/libstorage-ng-4.1.24/testsuite/SystemInfo/blkid.cc 2018-09-06 11:30:54.000000000 +0200 @@ -209,3 +209,19 @@ check(input, output); } + + +BOOST_AUTO_TEST_CASE(parse_luks) +{ + vector<string> input = { + "/dev/sdb1: UUID=\"b329b40b-e5f0-4f8e-814d-b6afb7f0ce64\" TYPE=\"crypto_LUKS\" PARTUUID=\"02cabc90-ca73-4302-928e-a924cda495bc\"", + "/dev/sdb2: UUID=\"332cd185-9d1b-479c-ade6-a9fb6e4e536d\" LABEL=\"master-plan\" TYPE=\"crypto_LUKS\" PARTUUID=\"20e9945b-1b57-4f46-89d8-b6321be05df3\"" + }; + + vector<string> output = { + "data[/dev/sdb1] -> is-luks:true luks-uuid:b329b40b-e5f0-4f8e-814d-b6afb7f0ce64", + "data[/dev/sdb2] -> is-luks:true luks-uuid:332cd185-9d1b-479c-ade6-a9fb6e4e536d luks-label:master-plan" + }; + + check(input, output); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.1.22/testsuite/Utils/systemcmd.cc new/libstorage-ng-4.1.24/testsuite/Utils/systemcmd.cc --- old/libstorage-ng-4.1.22/testsuite/Utils/systemcmd.cc 2018-09-02 14:01:32.000000000 +0200 +++ new/libstorage-ng-4.1.24/testsuite/Utils/systemcmd.cc 2018-09-06 11:30:54.000000000 +0200 @@ -25,6 +25,7 @@ return boost::join(input, "\n") + "\n"; } + class Fixture { public: @@ -159,3 +160,19 @@ BOOST_CHECK_THROW({SystemCmd cmd( "/etc/fstab", SystemCmd::ThrowBehaviour::DoThrow);}, SystemCmdException); } + + +BOOST_AUTO_TEST_CASE(env) +{ + vector<string> stdout = { + "C ++" + }; + + setenv("LC_ALL", "en_US", 1); // will be overridden + setenv("FUNNY", "++", 1); // will not be overridden + + SystemCmd cmd("echo $LC_ALL $FUNNY"); + + BOOST_CHECK(cmd.retcode() == 0); + BOOST_CHECK_EQUAL(join(cmd.stdout()), join(stdout)); +}