From dc016e8925b2d267a5ff094102f35f6a177f427d Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Wed, 28 Jul 2021 09:05:24 +0200 Subject: [PATCH] New version 2.26 - Add missing plugins to the default config (vtrefny) - remove unused variable and fix build with LLVM/clang (tpgxyz) - exec: Fix deprecated glib function call Glib will rename "g_spawn_check_exit_status()" to "g_spawn_check_wait_status()" in version 2.69. (manuel.wassermann97) - tests: Tag LvmPVVGLVcachePoolCreateRemoveTestCase as unstable (vtrefny) - tests: Force remove LVM VG /dev/ entry not removed by vgremove (vtrefny) - tests: Do not try to remove VG before removing the VDO pool (vtrefny) - crypto: Let cryptsetup autodect encryption sector size when not specified (vtrefny) - Fix skipping tests on Debian testing (vtrefny) - tests: Temporarily skip test_snapshotcreate_lvorigin_snapshotmerge (vtrefny) - tests: Do not check that XFS shrink fails with xfsprogs >= 5.12 (vtrefny) - tests: Make sure the test temp mount is always unmounted (vtrefny) - swap: Fix memory leak (vtrefny) - mdraid: Fix memory leak (vtrefny) - lvm-dbus: Fix memory leak (vtrefny) - kbd: Fix memory leak (vtrefny) - fs: Fix memory leak (vtrefny) - dm: Fix memory leak in the DM plugin and DM logging redirect function (vtrefny) - crypto: Fix memory leak (vtrefny) - kbd: Fix memory leak (vtrefny) - tests: Call fs_vfat_mkfs with "--mbr=n" extra option in tests (vtrefny) - fs: Allow using empty label for vfat with newest dosfstools (vtrefny) - vdo: Do not use g_memdup in bd_vdo_stats_copy (vtrefny) - crypto: Fix default key size for non XTS ciphers (vtrefny) - NEWS.rts: Fix markup (vtrefny) --- .gitignore | 1 + ...omparing-DM-RAID-member-devices-UUID.patch | 27 --- 0002-Fix-setting-locale-for-util-calls.patch | 119 ------------- ...etup-autodect-encryption-sector-size.patch | 166 ------------------ libblockdev-gcc11.patch | 15 -- libblockdev.spec | 40 +++-- sources | 2 +- 7 files changed, 30 insertions(+), 340 deletions(-) delete mode 100644 0001-Fix-comparing-DM-RAID-member-devices-UUID.patch delete mode 100644 0002-Fix-setting-locale-for-util-calls.patch delete mode 100644 0002-Let-cryptsetup-autodect-encryption-sector-size.patch delete mode 100644 libblockdev-gcc11.patch diff --git a/.gitignore b/.gitignore index ae739c7..9764cd3 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ /libblockdev-2.23.tar.gz /libblockdev-2.24.tar.gz /libblockdev-2.25.tar.gz +/libblockdev-2.26.tar.gz diff --git a/0001-Fix-comparing-DM-RAID-member-devices-UUID.patch b/0001-Fix-comparing-DM-RAID-member-devices-UUID.patch deleted file mode 100644 index 0c3eedc..0000000 --- a/0001-Fix-comparing-DM-RAID-member-devices-UUID.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 2da13152619ee7233650339797657b45088b2219 Mon Sep 17 00:00:00 2001 -From: Vojtech Trefny -Date: Tue, 18 Aug 2020 09:44:29 +0200 -Subject: [PATCH] dm: Fix comparing DM RAID member devices UUID - -There is no "UUID" property in UDev we must use the "ID_FS_UUID" -one. -This comparison works only because most DM RAID members don't have -UUID so the check is skipped, but it fails for DDF RAID members -which have a special GUID/UUID in UDev database. ---- - src/plugins/dm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/plugins/dm.c b/src/plugins/dm.c -index a6412028..4ab0d2a4 100644 ---- a/src/plugins/dm.c -+++ b/src/plugins/dm.c -@@ -482,7 +482,7 @@ static gboolean raid_dev_matches_spec (struct raid_dev *raid_dev, const gchar *n - - context = udev_new (); - device = udev_device_new_from_subsystem_sysname (context, "block", dev_name); -- dev_uuid = udev_device_get_property_value (device, "UUID"); -+ dev_uuid = udev_device_get_property_value (device, "ID_FS_UUID"); - major_str = udev_device_get_property_value (device, "MAJOR"); - minor_str = udev_device_get_property_value (device, "MINOR"); - diff --git a/0002-Fix-setting-locale-for-util-calls.patch b/0002-Fix-setting-locale-for-util-calls.patch deleted file mode 100644 index 52d9a66..0000000 --- a/0002-Fix-setting-locale-for-util-calls.patch +++ /dev/null @@ -1,119 +0,0 @@ -From a29d25fdfdcd7b133052eab1a3d1defe12c1733f Mon Sep 17 00:00:00 2001 -From: Vojtech Trefny -Date: Wed, 10 Jun 2020 17:03:28 +0200 -Subject: [PATCH] exec: Fix setting locale for util calls - -This actually fixes two issue. The _utils_exec_and_report_progress -function didn't set the LC_ALL=C environment variable to make sure -we get output in English. And also we shouldn't use setenv in the -GSpawnChildSetupFunc, it's actually example of what not to do in -g_spawn_async documentation. This fix uses g_environ_setenv and -passes the new environment to the g_spawn call. ---- - src/utils/exec.c | 26 +++++++++++++++++--------- - tests/utils_test.py | 7 +++++++ - 2 files changed, 24 insertions(+), 9 deletions(-) - -diff --git a/src/utils/exec.c b/src/utils/exec.c -index 9293930..37bd960 100644 ---- a/src/utils/exec.c -+++ b/src/utils/exec.c -@@ -140,11 +140,6 @@ static void log_done (guint64 task_id, gint exit_code) { - return; - } - --static void set_c_locale(gpointer user_data __attribute__((unused))) { -- if (setenv ("LC_ALL", "C", 1) != 0) -- g_warning ("Failed to set LC_ALL=C for a child process!"); --} -- - /** - * bd_utils_exec_and_report_error: - * @argv: (array zero-terminated=1): the argv array for the call -@@ -194,6 +189,8 @@ gboolean bd_utils_exec_and_report_status_error (const gchar **argv, const BDExtr - const BDExtraArg **extra_p = NULL; - gint exit_status = 0; - guint i = 0; -+ gchar **old_env = NULL; -+ gchar **new_env = NULL; - - if (extra) { - args_len = g_strv_length ((gchar **) argv); -@@ -219,16 +216,20 @@ gboolean bd_utils_exec_and_report_status_error (const gchar **argv, const BDExtr - args[i] = NULL; - } - -+ old_env = g_get_environ (); -+ new_env = g_environ_setenv (old_env, "LC_ALL", "C", TRUE); -+ - task_id = log_running (args ? args : argv); -- success = g_spawn_sync (NULL, args ? (gchar **) args : (gchar **) argv, NULL, G_SPAWN_SEARCH_PATH, -- (GSpawnChildSetupFunc) set_c_locale, NULL, -- &stdout_data, &stderr_data, &exit_status, error); -+ success = g_spawn_sync (NULL, args ? (gchar **) args : (gchar **) argv, new_env, G_SPAWN_SEARCH_PATH, -+ NULL, NULL, &stdout_data, &stderr_data, &exit_status, error); - if (!success) { - /* error is already populated from the call */ -+ g_strfreev (new_env); - g_free (stdout_data); - g_free (stderr_data); - return FALSE; - } -+ g_strfreev (new_env); - - /* g_spawn_sync set the status in the same way waitpid() does, we need - to get the process exit code manually (this is similar to calling -@@ -297,6 +298,8 @@ static gboolean _utils_exec_and_report_progress (const gchar **argv, const BDExt - gboolean err_done = FALSE; - GString *stdout_data = g_string_new (NULL); - GString *stderr_data = g_string_new (NULL); -+ gchar **old_env = NULL; -+ gchar **new_env = NULL; - - /* TODO: share this code between functions */ - if (extra) { -@@ -325,7 +328,10 @@ static gboolean _utils_exec_and_report_progress (const gchar **argv, const BDExt - - task_id = log_running (args ? args : argv); - -- ret = g_spawn_async_with_pipes (NULL, args ? (gchar**) args : (gchar**) argv, NULL, -+ old_env = g_get_environ (); -+ new_env = g_environ_setenv (old_env, "LC_ALL", "C", TRUE); -+ -+ ret = g_spawn_async_with_pipes (NULL, args ? (gchar**) args : (gchar**) argv, new_env, - G_SPAWN_DEFAULT|G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD, - NULL, NULL, &pid, NULL, &out_fd, &err_fd, error); - -@@ -333,9 +339,11 @@ static gboolean _utils_exec_and_report_progress (const gchar **argv, const BDExt - /* error is already populated */ - g_string_free (stdout_data, TRUE); - g_string_free (stderr_data, TRUE); -+ g_strfreev (new_env); - g_free (args); - return FALSE; - } -+ g_strfreev (new_env); - - args_str = g_strjoinv (" ", args ? (gchar **) args : (gchar **) argv); - msg = g_strdup_printf ("Started '%s'", args_str); -diff --git a/tests/utils_test.py b/tests/utils_test.py -index 4bec3db..2bec5ed 100644 ---- a/tests/utils_test.py -+++ b/tests/utils_test.py -@@ -170,6 +170,13 @@ class UtilsExecLoggingTest(UtilsTestCase): - # exit code != 0 - self.assertTrue(BlockDev.utils_check_util_version("libblockdev-fake-util-fail", "1.1", "version", "Version:\\s(.*)")) - -+ @tag_test(TestTags.NOSTORAGE, TestTags.CORE) -+ def test_exec_locale(self): -+ """Verify that setting locale for exec functions works as expected""" -+ -+ succ, out = BlockDev.utils_exec_and_capture_output(["locale"]) -+ self.assertTrue(succ) -+ self.assertIn("LC_ALL=C", out) - - class UtilsDevUtilsTestCase(UtilsTestCase): - @tag_test(TestTags.NOSTORAGE, TestTags.CORE) --- -2.26.2 - diff --git a/0002-Let-cryptsetup-autodect-encryption-sector-size.patch b/0002-Let-cryptsetup-autodect-encryption-sector-size.patch deleted file mode 100644 index 0e3e2ea..0000000 --- a/0002-Let-cryptsetup-autodect-encryption-sector-size.patch +++ /dev/null @@ -1,166 +0,0 @@ -From d05deed377b4e793c8c319eb028b8343fb317586 Mon Sep 17 00:00:00 2001 -From: Vojtech Trefny -Date: Wed, 16 Jun 2021 16:15:38 +0200 -Subject: [PATCH] crypto: Let cryptsetup autodect encryption sector size when - not specified - -Thanks to this 4k sector size will be used on 4k drives. ---- - configure.ac | 2 + - src/plugins/crypto.h | 6 +++ - tests/crypto_test.py | 93 ++++++++++++++++++++++++++++++++++++++------ - 3 files changed, 89 insertions(+), 12 deletions(-) - -diff --git a/configure.ac b/configure.ac -index abe1412..ad71a46 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -211,6 +211,8 @@ AS_IF([test "x$with_crypto" != "xno"], - [AC_DEFINE([LIBCRYPTSETUP_2])], []) - AS_IF([$PKG_CONFIG --atleast-version=2.3.0 libcryptsetup], - [AC_DEFINE([LIBCRYPTSETUP_BITLK])], []) -+ AS_IF([$PKG_CONFIG --atleast-version=2.4.0 libcryptsetup], -+ [AC_DEFINE([LIBCRYPTSETUP_24])], []) - AS_IF([test "x$with_escrow" != "xno"], - [LIBBLOCKDEV_PKG_CHECK_MODULES([NSS], [nss >= 3.18.0]) - LIBBLOCKDEV_CHECK_HEADER([volume_key/libvolume_key.h], [$GLIB_CFLAGS $NSS_CFLAGS], [libvolume_key.h not available])], -diff --git a/src/plugins/crypto.h b/src/plugins/crypto.h -index 71a1438..fef1e73 100644 ---- a/src/plugins/crypto.h -+++ b/src/plugins/crypto.h -@@ -38,7 +38,13 @@ typedef enum { - - #define DEFAULT_LUKS_KEYSIZE_BITS 512 - #define DEFAULT_LUKS_CIPHER "aes-xts-plain64" -+ -+#ifdef LIBCRYPTSETUP_24 -+/* 0 for autodetect since 2.4.0 */ -+#define DEFAULT_LUKS2_SECTOR_SIZE 0 -+#else - #define DEFAULT_LUKS2_SECTOR_SIZE 512 -+#endif - - typedef enum { - BD_CRYPTO_TECH_LUKS = 0, -diff --git a/tests/crypto_test.py b/tests/crypto_test.py -index 0609a07..3e99a2d 100644 ---- a/tests/crypto_test.py -+++ b/tests/crypto_test.py -@@ -16,26 +16,18 @@ PASSWD = "myshinylittlepassword" - PASSWD2 = "myshinylittlepassword2" - PASSWD3 = "myshinylittlepassword3" - --def have_luks2(): -- try: -- succ = BlockDev.utils_check_util_version("cryptsetup", "2.0.3", "--version", r"cryptsetup ([0-9+\.]+)") -- except GLib.GError: -- return False -- else: -- return succ -- - --def have_bitlk(): -+def check_cryptsetup_version(version): - try: -- succ = BlockDev.utils_check_util_version("cryptsetup", "2.3.0", "--version", r"cryptsetup ([0-9+\.]+)") -+ succ = BlockDev.utils_check_util_version("cryptsetup", version, "--version", r"cryptsetup ([0-9+\.]+)") - except GLib.GError: - return False - else: - return succ - - --HAVE_LUKS2 = have_luks2() --HAVE_BITLK = have_bitlk() -+HAVE_LUKS2 = check_cryptsetup_version("2.0.3") -+HAVE_BITLK = check_cryptsetup_version("2.3.0") - - - class CryptoTestCase(unittest.TestCase): -@@ -928,6 +920,83 @@ class CryptoTestInfo(CryptoTestCase): - succ = BlockDev.crypto_luks_close("libblockdevTestLUKS") - self.assertTrue(succ) - -+ -+class CryptoTestLuksSectorSize(CryptoTestCase): -+ def setUp(self): -+ if not check_cryptsetup_version("2.4.0"): -+ self.skipTest("cryptsetup encryption sector size not available, skipping.") -+ -+ # we need a loop devices for this test case -+ self.addCleanup(self._clean_up) -+ self.dev_file = create_sparse_tempfile("crypto_test", 1024**3) -+ self.dev_file2 = create_sparse_tempfile("crypto_test", 1024**3) -+ -+ succ, loop = BlockDev.loop_setup(self.dev_file) -+ if not succ: -+ raise RuntimeError("Failed to setup loop device for testing") -+ self.loop_dev = "/dev/%s" % loop -+ -+ succ, loop = BlockDev.loop_setup(self.dev_file) -+ if not succ: -+ raise RuntimeError("Failed to setup loop device for testing") -+ self.loop_dev2 = "/dev/%s" % loop -+ -+ # set sector size of the loop device to 4k -+ ret, _out, _err = run_command("losetup --sector-size 4096 %s" % self.loop_dev) -+ self.assertEqual(ret, 0) -+ -+ def _clean_up(self): -+ try: -+ BlockDev.crypto_luks_close("libblockdevTestLUKS") -+ except: -+ pass -+ -+ BlockDev.loop_teardown(self.loop_dev) -+ os.unlink(self.dev_file) -+ -+ BlockDev.loop_teardown(self.loop_dev2) -+ os.unlink(self.dev_file2) -+ -+ @tag_test(TestTags.SLOW) -+ @unittest.skipUnless(HAVE_LUKS2, "LUKS 2 not supported") -+ def test_luks2_sector_size_autodetect(self): -+ """Verify that we can autodetect 4k drives and set 4k sector size for them""" -+ -+ # format the 4k loop device, encryption sector size should default to 4096 -+ succ = BlockDev.crypto_luks_format(self.loop_dev, "aes-cbc-essiv:sha256", 256, PASSWD, None, 0, -+ BlockDev.CryptoLUKSVersion.LUKS2) -+ self.assertTrue(succ) -+ -+ succ = BlockDev.crypto_luks_open(self.loop_dev, "libblockdevTestLUKS", PASSWD, None, False) -+ self.assertTrue(succ) -+ -+ info = BlockDev.crypto_luks_info("libblockdevTestLUKS") -+ self.assertIsNotNone(info) -+ -+ self.assertEqual(info.version, BlockDev.CryptoLUKSVersion.LUKS2) -+ self.assertEqual(info.sector_size, 4096) -+ -+ succ = BlockDev.crypto_luks_close("libblockdevTestLUKS") -+ self.assertTrue(succ) -+ -+ # with the 512 loop device, we should still get 512 -+ succ = BlockDev.crypto_luks_format(self.loop_dev2, "aes-cbc-essiv:sha256", 256, PASSWD, None, 0, -+ BlockDev.CryptoLUKSVersion.LUKS2) -+ self.assertTrue(succ) -+ -+ succ = BlockDev.crypto_luks_open(self.loop_dev2, "libblockdevTestLUKS", PASSWD, None, False) -+ self.assertTrue(succ) -+ -+ info = BlockDev.crypto_luks_info("libblockdevTestLUKS") -+ self.assertIsNotNone(info) -+ -+ self.assertEqual(info.version, BlockDev.CryptoLUKSVersion.LUKS2) -+ self.assertEqual(info.sector_size, 512) -+ -+ succ = BlockDev.crypto_luks_close("libblockdevTestLUKS") -+ self.assertTrue(succ) -+ -+ - class CryptoTestIntegrity(CryptoTestCase): - @tag_test(TestTags.SLOW) - @unittest.skipUnless(HAVE_LUKS2, "LUKS 2 not supported") --- -2.31.1 - diff --git a/libblockdev-gcc11.patch b/libblockdev-gcc11.patch deleted file mode 100644 index 6e5fe35..0000000 --- a/libblockdev-gcc11.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/src/plugins/kbd.c b/src/plugins/kbd.c -index a2908ec..97abd3b 100644 ---- a/src/plugins/kbd.c -+++ b/src/plugins/kbd.c -@@ -732,6 +732,10 @@ static gboolean wait_for_file (const char *filename) { - * - * Tech category: %BD_KBD_TECH_BCACHE-%BD_KBD_TECH_MODE_CREATE - */ -+/* This triggers a known false positive warning in gcc-11. It's being -+ addressed upstream, but until the fix is available, this works around -+ the false positive. */ -+__attribute__ ((optimize ("-O1"))) - gboolean bd_kbd_bcache_create (const gchar *backing_device, const gchar *cache_device, const BDExtraArg **extra, const gchar **bcache_device, GError **error) { - const gchar *argv[6] = {"make-bcache", "-B", backing_device, "-C", cache_device, NULL}; - gboolean success = FALSE; diff --git a/libblockdev.spec b/libblockdev.spec index 362d1ca..3e6a27c 100644 --- a/libblockdev.spec +++ b/libblockdev.spec @@ -124,15 +124,12 @@ %define configure_opts %{?python2_copts} %{?python3_copts} %{?bcache_copts} %{?lvm_dbus_copts} %{?btrfs_copts} %{?crypto_copts} %{?dm_copts} %{?loop_copts} %{?lvm_copts} %{?lvm_dbus_copts} %{?mdraid_copts} %{?mpath_copts} %{?swap_copts} %{?kbd_copts} %{?part_copts} %{?fs_copts} %{?nvdimm_copts} %{?vdo_copts} %{?tools_copts} %{?gi_copts} Name: libblockdev -Version: 2.25 -Release: 5%{?dist} +Version: 2.26 +Release: 1%{?dist} Summary: A library for low-level manipulation with block devices License: LGPLv2+ URL: https://github.com/storaged-project/libblockdev Source0: https://github.com/storaged-project/libblockdev/releases/download/%{version}-%{release}/%{name}-%{version}.tar.gz -Patch0: libblockdev-gcc11.patch -Patch1: 0001-Fix-comparing-DM-RAID-member-devices-UUID.patch -Patch2: 0002-Let-cryptsetup-autodect-encryption-sector-size.patch BuildRequires: make BuildRequires: glib2-devel @@ -391,8 +388,6 @@ BuildRequires: device-mapper-devel Summary: The LVM plugin for the libblockdev library Requires: %{name}-utils%{?_isa} >= 0.11 Requires: lvm2 -# for thin_metadata_size -Requires: device-mapper-persistent-data %description lvm The libblockdev library plugin (and in the same time a standalone library) @@ -415,8 +410,6 @@ BuildRequires: device-mapper-devel Summary: The LVM plugin for the libblockdev library Requires: %{name}-utils%{?_isa} >= 1.4 Requires: lvm2-dbusd >= 2.02.156 -# for thin_metadata_size -Requires: device-mapper-persistent-data %description lvm-dbus The libblockdev library plugin (and in the same time a standalone library) @@ -684,9 +677,6 @@ A meta-package that pulls all the libblockdev plugins as dependencies. %prep %setup -q -n %{name}-%{version} -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 %build autoreconf -ivf @@ -990,6 +980,32 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm} %files plugins-all %changelog +* Wed Jul 28 2021 Vojtech Trefny - 2.26-1 +- Add missing plugins to the default config (vtrefny) +- remove unused variable and fix build with LLVM/clang (tpgxyz) +- exec: Fix deprecated glib function call Glib will rename "g_spawn_check_exit_status()" to "g_spawn_check_wait_status()" in version 2.69. (manuel.wassermann97) +- tests: Tag LvmPVVGLVcachePoolCreateRemoveTestCase as unstable (vtrefny) +- tests: Force remove LVM VG /dev/ entry not removed by vgremove (vtrefny) +- tests: Do not try to remove VG before removing the VDO pool (vtrefny) +- crypto: Let cryptsetup autodect encryption sector size when not specified (vtrefny) +- Fix skipping tests on Debian testing (vtrefny) +- tests: Temporarily skip test_snapshotcreate_lvorigin_snapshotmerge (vtrefny) +- tests: Do not check that XFS shrink fails with xfsprogs >= 5.12 (vtrefny) +- tests: Make sure the test temp mount is always unmounted (vtrefny) +- swap: Fix memory leak (vtrefny) +- mdraid: Fix memory leak (vtrefny) +- lvm-dbus: Fix memory leak (vtrefny) +- kbd: Fix memory leak (vtrefny) +- fs: Fix memory leak (vtrefny) +- dm: Fix memory leak in the DM plugin and DM logging redirect function (vtrefny) +- crypto: Fix memory leak (vtrefny) +- kbd: Fix memory leak (vtrefny) +- tests: Call fs_vfat_mkfs with "--mbr=n" extra option in tests (vtrefny) +- fs: Allow using empty label for vfat with newest dosfstools (vtrefny) +- vdo: Do not use g_memdup in bd_vdo_stats_copy (vtrefny) +- crypto: Fix default key size for non XTS ciphers (vtrefny) +- NEWS.rts: Fix markup (vtrefny) + * Thu Jul 22 2021 Fedora Release Engineering - 2.25-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/sources b/sources index 2c30c6a..3e17ce7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libblockdev-2.25.tar.gz) = 628d05f3a257b44208a9d0b5d84ae248fefd415812d9a93d132c03039b09fefc4d6110beb9aa0d3072e3f0c992e642d7867d0241209056538f132f86a748e195 +SHA512 (libblockdev-2.26.tar.gz) = ddd4e9c22135bd7dad0bb9bc254ac0c63e3bacc592e7c5a0c846e367da3fc248bf6187f1c81407c3bce599d3b0ceeec9a8a0030ad8e981e245f715b35eaec523