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 2023-01-05 14:59:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libstorage-ng (Old) and /work/SRC/openSUSE:Factory/.libstorage-ng.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libstorage-ng" Thu Jan 5 14:59:50 2023 rev:193 rq:1046686 version:4.5.61 Changes: -------- --- /work/SRC/openSUSE:Factory/libstorage-ng/libstorage-ng.changes 2023-01-03 15:04:47.174307056 +0100 +++ /work/SRC/openSUSE:Factory/.libstorage-ng.new.1563/libstorage-ng.changes 2023-01-05 14:59:52.956773770 +0100 @@ -1,0 +2,8 @@ +Wed Jan 4 07:49:40 UTC 2023 - aschn...@suse.com + +- merge gh#openSUSE/libstorage-ng#910 +- delay use of json output for qgroup show +- check creation of json tokener +- 4.5.61 + +-------------------------------------------------------------------- Old: ---- libstorage-ng-4.5.60.tar.xz New: ---- libstorage-ng-4.5.61.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libstorage-ng.spec ++++++ --- /var/tmp/diff_new_pack.1Gaxhv/_old 2023-01-05 14:59:53.528773310 +0100 +++ /var/tmp/diff_new_pack.1Gaxhv/_new 2023-01-05 14:59:53.532773307 +0100 @@ -18,7 +18,7 @@ %define libname %{name}1 Name: libstorage-ng -Version: 4.5.60 +Version: 4.5.61 Release: 0 Summary: Library for storage management License: GPL-2.0-only ++++++ libstorage-ng-4.5.60.tar.xz -> libstorage-ng-4.5.61.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.60/VERSION new/libstorage-ng-4.5.61/VERSION --- old/libstorage-ng-4.5.60/VERSION 2023-01-03 08:59:29.000000000 +0100 +++ new/libstorage-ng-4.5.61/VERSION 2023-01-04 08:49:40.000000000 +0100 @@ -1 +1 @@ -4.5.60 +4.5.61 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.60/storage/SystemInfo/CmdBtrfs.cc new/libstorage-ng-4.5.61/storage/SystemInfo/CmdBtrfs.cc --- old/libstorage-ng-4.5.60/storage/SystemInfo/CmdBtrfs.cc 2023-01-03 08:59:29.000000000 +0100 +++ new/libstorage-ng-4.5.61/storage/SystemInfo/CmdBtrfs.cc 2023-01-04 08:49:40.000000000 +0100 @@ -658,8 +658,8 @@ { query_version(); - // buggy in 6.1, reported, assume fixed in 6.1.1 (2023-01-02) - return major >= 7 || (major == 6 && minor >= 2) || (major == 6 && minor == 1 && patchlevel >= 1); + // buggy in 6.1, reported, assume fixed in 6.2 (2023-01-04) + return major >= 7 || (major == 6 && minor >= 2); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.60/storage/Utils/JsonFile.cc new/libstorage-ng-4.5.61/storage/Utils/JsonFile.cc --- old/libstorage-ng-4.5.60/storage/Utils/JsonFile.cc 2023-01-03 08:59:29.000000000 +0100 +++ new/libstorage-ng-4.5.61/storage/Utils/JsonFile.cc 2023-01-04 08:49:40.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) [2017-2022] SUSE LLC + * Copyright (c) [2017-2023] SUSE LLC * * All Rights Reserved. * @@ -35,11 +35,33 @@ namespace storage { + class JsonTokener + { + public: + + JsonTokener() + : p(json_tokener_new()) + { + ST_CHECK_NEW(p); + } + + ~JsonTokener() + { + json_tokener_free(p); + } + + json_tokener* get() { return p; } + + private: + + json_tokener* p; + + }; + + JsonFile::JsonFile(const vector<string>& lines) { - std::unique_ptr<json_tokener, std::function<void(json_tokener*)>> tokener( - json_tokener_new(), [](json_tokener* p) { json_tokener_free(p); } - ); + JsonTokener tokener; for (const string& line : lines) { @@ -85,9 +107,7 @@ if (fclose(fp) != 0) ST_THROW(Exception(sformat("close for json file '%s' failed", filename))); - std::unique_ptr<json_tokener, std::function<void(json_tokener*)>> tokener( - json_tokener_new(), [](json_tokener* p) { json_tokener_free(p); } - ); + JsonTokener tokener; root = json_tokener_parse_ex(tokener.get(), data.data(), st.st_size); @@ -97,7 +117,7 @@ ST_THROW(Exception(sformat("parsing json file '%s' failed", filename))); } - if (tokener->char_offset != st.st_size) + if (tokener.get()->char_offset != st.st_size) { json_object_put(root); ST_THROW(Exception(sformat("excessive content in json file '%s'", filename))); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.60/testsuite/SystemInfo/Makefile.am new/libstorage-ng-4.5.61/testsuite/SystemInfo/Makefile.am --- old/libstorage-ng-4.5.60/testsuite/SystemInfo/Makefile.am 2023-01-03 08:59:29.000000000 +0100 +++ new/libstorage-ng-4.5.61/testsuite/SystemInfo/Makefile.am 2023-01-04 08:49:40.000000000 +0100 @@ -11,7 +11,7 @@ btrfs-filesystem-show.test \ btrfs-subvolume-get-default.test btrfs-subvolume-list.test \ btrfs-subvolume-show.test btrfs-qgroup-show-60.test \ - btrfs-qgroup-show-602.test btrfs-qgroup-show-611.test \ + btrfs-qgroup-show-602.test btrfs-qgroup-show-62.test \ cryptsetup-status.test \ cryptsetup-bitlk-dump.test cryptsetup-luks-dump.test dasdview.test \ dir.test dmraid.test dumpe2fs.test resize2fs.test ntfsresize.test \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.60/testsuite/SystemInfo/btrfs-qgroup-show-611.cc new/libstorage-ng-4.5.61/testsuite/SystemInfo/btrfs-qgroup-show-611.cc --- old/libstorage-ng-4.5.60/testsuite/SystemInfo/btrfs-qgroup-show-611.cc 2023-01-03 08:59:29.000000000 +0100 +++ new/libstorage-ng-4.5.61/testsuite/SystemInfo/btrfs-qgroup-show-611.cc 1970-01-01 01:00:00.000000000 +0100 @@ -1,127 +0,0 @@ - -#define BOOST_TEST_DYN_LINK -#define BOOST_TEST_MODULE libstorage - -#include <numeric> -#include <boost/test/unit_test.hpp> - -#include "storage/SystemInfo/CmdBtrfs.h" -#include "storage/Utils/Mockup.h" -#include "storage/Utils/SystemCmd.h" -#include "storage/Utils/StorageDefines.h" - - -using namespace std; -using namespace storage; - - -void -check(const vector<string>& input, const vector<string>& output) -{ - Mockup::set_mode(Mockup::Mode::PLAYBACK); - Mockup::set_command(BTRFS_BIN " --version", RemoteCommand({ "btrfs-progs v6.1.1" }, {}, 0)); - Mockup::set_command(BTRFS_BIN " --format json qgroup show -rep --raw (device:/dev/system/btrfs)", input); - - CmdBtrfsQgroupShow cmd_btrfs_qgroup_show( - CmdBtrfsQgroupShow::key_t("/dev/system/btrfs"), "/btrfs" - ); - - ostringstream parsed; - parsed.setf(std::ios::boolalpha); - parsed << cmd_btrfs_qgroup_show; - - string lhs = parsed.str(); - string rhs = accumulate(output.begin(), output.end(), ""s, - [](auto a, auto b) { return a + b + "\n"; }); - - BOOST_CHECK_EQUAL(lhs, rhs); -} - - -BOOST_AUTO_TEST_CASE(parse) -{ - set_logger(get_stdout_logger()); - - vector<string> input = { - "{", - " \"__header\": {", - " \"version\": \"1\"", - " },", - " \"qgroup-show\": [", - " {", - " \"qgroupid\": \"0/5\",", - " \"referenced\": \"16384\",", - " \"max_referenced\": \"none\",", - " \"exclusive\": \"16384\",", - " \"max_exclusive\": \"none\",", - " \"path\": \"\",", - " \"parents\": [", - " ],", - " \"children\": [", - " ]", - " },", - " {", - " \"qgroupid\": \"0/256\",", - " \"referenced\": \"16384\",", - " \"max_referenced\": \"none\",", - " \"exclusive\": \"16384\",", - " \"max_exclusive\": \"none\",", - " \"path\": \"a\",", - " \"parents\": [", - " \"1/0\"", - " ],", - " \"children\": [", - " ]", - " },", - " {", - " \"qgroupid\": \"0/257\",", - " \"referenced\": \"16384\",", - " \"max_referenced\": \"none\",", - " \"exclusive\": \"16384\",", - " \"max_exclusive\": \"none\",", - " \"path\": \"b\",", - " \"parents\": [", - " ],", - " \"children\": [", - " ]", - " },", - " {", - " \"qgroupid\": \"1/0\",", - " \"referenced\": \"32768\",", - " \"max_referenced\": \"none\",", - " \"exclusive\": \"32768\",", - " \"max_exclusive\": \"2147483648\",", - " \"path\": \"\",", - " \"parents\": [", - " ],", - " \"children\": [", - " \"0/256\",", - " \"0/257\"", - " ]", - " },", - " {", - " \"qgroupid\": \"2/0\",", - " \"referenced\": \"0\",", - " \"max_referenced\": \"1073741824\",", - " \"exclusive\": \"0\",", - " \"max_exclusive\": \"none\",", - " \"path\": \"\",", - " \"parents\": [", - " ],", - " \"children\": [", - " ]", - " }", - " ]", - "}" - }; - - vector<string> output = { - "id:0/5 referenced:16384 exclusive:16384", - "id:0/256 referenced:16384 exclusive:16384 parents:1/0", - "id:0/257 referenced:16384 exclusive:16384", - "id:1/0 referenced:32768 exclusive:32768 exclusive-limit:2147483648", - "id:2/0 referenced:0 exclusive:0 referenced-limit:1073741824" - }; - - check(input, output); -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.60/testsuite/SystemInfo/btrfs-qgroup-show-62.cc new/libstorage-ng-4.5.61/testsuite/SystemInfo/btrfs-qgroup-show-62.cc --- old/libstorage-ng-4.5.60/testsuite/SystemInfo/btrfs-qgroup-show-62.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-ng-4.5.61/testsuite/SystemInfo/btrfs-qgroup-show-62.cc 2023-01-04 08:49:40.000000000 +0100 @@ -0,0 +1,127 @@ + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE libstorage + +#include <numeric> +#include <boost/test/unit_test.hpp> + +#include "storage/SystemInfo/CmdBtrfs.h" +#include "storage/Utils/Mockup.h" +#include "storage/Utils/SystemCmd.h" +#include "storage/Utils/StorageDefines.h" + + +using namespace std; +using namespace storage; + + +void +check(const vector<string>& input, const vector<string>& output) +{ + Mockup::set_mode(Mockup::Mode::PLAYBACK); + Mockup::set_command(BTRFS_BIN " --version", RemoteCommand({ "btrfs-progs v6.2" }, {}, 0)); + Mockup::set_command(BTRFS_BIN " --format json qgroup show -rep --raw (device:/dev/system/btrfs)", input); + + CmdBtrfsQgroupShow cmd_btrfs_qgroup_show( + CmdBtrfsQgroupShow::key_t("/dev/system/btrfs"), "/btrfs" + ); + + ostringstream parsed; + parsed.setf(std::ios::boolalpha); + parsed << cmd_btrfs_qgroup_show; + + string lhs = parsed.str(); + string rhs = accumulate(output.begin(), output.end(), ""s, + [](auto a, auto b) { return a + b + "\n"; }); + + BOOST_CHECK_EQUAL(lhs, rhs); +} + + +BOOST_AUTO_TEST_CASE(parse) +{ + set_logger(get_stdout_logger()); + + vector<string> input = { + "{", + " \"__header\": {", + " \"version\": \"1\"", + " },", + " \"qgroup-show\": [", + " {", + " \"qgroupid\": \"0/5\",", + " \"referenced\": \"16384\",", + " \"max_referenced\": \"none\",", + " \"exclusive\": \"16384\",", + " \"max_exclusive\": \"none\",", + " \"path\": \"\",", + " \"parents\": [", + " ],", + " \"children\": [", + " ]", + " },", + " {", + " \"qgroupid\": \"0/256\",", + " \"referenced\": \"16384\",", + " \"max_referenced\": \"none\",", + " \"exclusive\": \"16384\",", + " \"max_exclusive\": \"none\",", + " \"path\": \"a\",", + " \"parents\": [", + " \"1/0\"", + " ],", + " \"children\": [", + " ]", + " },", + " {", + " \"qgroupid\": \"0/257\",", + " \"referenced\": \"16384\",", + " \"max_referenced\": \"none\",", + " \"exclusive\": \"16384\",", + " \"max_exclusive\": \"none\",", + " \"path\": \"b\",", + " \"parents\": [", + " ],", + " \"children\": [", + " ]", + " },", + " {", + " \"qgroupid\": \"1/0\",", + " \"referenced\": \"32768\",", + " \"max_referenced\": \"none\",", + " \"exclusive\": \"32768\",", + " \"max_exclusive\": \"2147483648\",", + " \"path\": \"\",", + " \"parents\": [", + " ],", + " \"children\": [", + " \"0/256\",", + " \"0/257\"", + " ]", + " },", + " {", + " \"qgroupid\": \"2/0\",", + " \"referenced\": \"0\",", + " \"max_referenced\": \"1073741824\",", + " \"exclusive\": \"0\",", + " \"max_exclusive\": \"none\",", + " \"path\": \"\",", + " \"parents\": [", + " ],", + " \"children\": [", + " ]", + " }", + " ]", + "}" + }; + + vector<string> output = { + "id:0/5 referenced:16384 exclusive:16384", + "id:0/256 referenced:16384 exclusive:16384 parents:1/0", + "id:0/257 referenced:16384 exclusive:16384", + "id:1/0 referenced:32768 exclusive:32768 exclusive-limit:2147483648", + "id:2/0 referenced:0 exclusive:0 referenced-limit:1073741824" + }; + + check(input, output); +}