commit df2fe12049296c0350fd5935657e00b11113a372 Author: CentOS Sources Date: Tue Mar 28 12:24:24 2023 +0000 import udisks2-2.9.4-7.el9 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bbb221c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/udisks-2.9.4.tar.bz2 diff --git a/.udisks2.metadata b/.udisks2.metadata new file mode 100644 index 0000000..c779a78 --- /dev/null +++ b/.udisks2.metadata @@ -0,0 +1 @@ +e6f21e90456360723d80265c4d3372eb88ef7a6e SOURCES/udisks-2.9.4.tar.bz2 diff --git a/SOURCES/ignore-apple-boot-part.patch b/SOURCES/ignore-apple-boot-part.patch new file mode 100644 index 0000000..0c57303 --- /dev/null +++ b/SOURCES/ignore-apple-boot-part.patch @@ -0,0 +1,25 @@ +From b9863c11601e199420a375e13505e2b795de77c5 Mon Sep 17 00:00:00 2001 +From: Frederick Grose <4335897+FGrose@users.noreply.github.com> +Date: Tue, 9 Feb 2021 19:02:01 -0500 +Subject: [PATCH] 80-udisks2.rules: Ignore Apple boot partition from + livecd-tools + +https://github.com/livecd-tools/livecd-tools/pull/176 creates a new boot +partition with livecd-iso-to-disk from Fedora Live .iso files that UDISKS +should ignore. +--- + data/80-udisks2.rules | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/data/80-udisks2.rules b/data/80-udisks2.rules +index fb50f48a0..d6fa072fd 100644 +--- a/data/80-udisks2.rules ++++ b/data/80-udisks2.rules +@@ -122,6 +122,7 @@ ENV{ID_PART_ENTRY_SCHEME}=="mac", ENV{ID_PART_ENTRY_TYPE}=="Apple_Bootstrap", EN + + # Apple Boot partitions + ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_TYPE}=="426f6f74-0000-11aa-aa11-00306543ecac", ENV{UDISKS_IGNORE}="1" ++ENV{ID_FS_LABEL}=="ANACONDA", ENV{ID_PART_ENTRY_TYPE}=="48465300-0000-11aa-aa11-00306543ecac|0xaf", ENV{UDISKS_IGNORE}="1" + + # special DOS partition types (EFI, hidden, etc.) and RAID/LVM + # see http://www.win.tue.nl/~aeb/partitions/partition_types-1.html diff --git a/SOURCES/udisks-2.10.0-block_format_ata_secure_erase.patch b/SOURCES/udisks-2.10.0-block_format_ata_secure_erase.patch new file mode 100644 index 0000000..3ad878d --- /dev/null +++ b/SOURCES/udisks-2.10.0-block_format_ata_secure_erase.patch @@ -0,0 +1,60 @@ +From eb917d346bc8592924c5f6566b01841176c53c8c Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Mon, 22 Aug 2022 16:27:11 +0200 +Subject: [PATCH] udiskslinuxblock: Only permit ATA Secure Erase during + Format() on a whole block device + +ATA Secure Erase requested as an option to the Format() method call used +to perform the actual erase on a whole drive object it looked up. When +Format() was called on a partition, this led to data loss on a whole drive. +This commit adds a safeguard to check that the Format() is requested +on a whole block device. + +Severity of this issue was slightly lowered by a failure to submit +the ATA Secure erase command in case some filesystem was mounted +at that point. +--- + src/udiskslinuxblock.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/src/udiskslinuxblock.c b/src/udiskslinuxblock.c +index d1da94edf..db0ed2bf6 100644 +--- a/src/udiskslinuxblock.c ++++ b/src/udiskslinuxblock.c +@@ -2354,6 +2354,7 @@ erase_ata_device (UDisksBlock *block, + { + gboolean ret = FALSE; + UDisksObject *drive_object = NULL; ++ UDisksLinuxBlockObject *block_object = NULL; + UDisksDriveAta *ata = NULL; + + drive_object = udisks_daemon_find_object (daemon, udisks_block_get_drive (block)); +@@ -2369,6 +2370,20 @@ erase_ata_device (UDisksBlock *block, + goto out; + } + ++ /* Reverse check to ensure we're erasing whole block device and not a partition */ ++ block_object = udisks_linux_drive_object_get_block (UDISKS_LINUX_DRIVE_OBJECT (drive_object), FALSE /* get_hw */); ++ if (block_object == NULL) ++ { ++ g_set_error (error, UDISKS_ERROR, UDISKS_ERROR_FAILED, "Couldn't find a block device for the drive to erase"); ++ goto out; ++ } ++ if (g_strcmp0 (g_dbus_object_get_object_path (G_DBUS_OBJECT (object)), ++ g_dbus_object_get_object_path (G_DBUS_OBJECT (block_object))) != 0) ++ { ++ g_set_error (error, UDISKS_ERROR, UDISKS_ERROR_FAILED, "ATA secure erase needs to be performed on a whole block device"); ++ goto out; ++ } ++ + /* sleep a tiny bit here to avoid the secure erase code racing with + * programs spawned by udev + */ +@@ -2382,6 +2397,7 @@ erase_ata_device (UDisksBlock *block, + out: + g_clear_object (&ata); + g_clear_object (&drive_object); ++ g_clear_object (&block_object); + return ret; + } + diff --git a/SOURCES/udisks-2.10.0-iscsi-auth-info.patch b/SOURCES/udisks-2.10.0-iscsi-auth-info.patch new file mode 100644 index 0000000..633386e --- /dev/null +++ b/SOURCES/udisks-2.10.0-iscsi-auth-info.patch @@ -0,0 +1,29 @@ +From 9a6e6b700b19539465ab6b241f04b94d4b3769c4 Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Mon, 10 Oct 2022 13:55:29 +0200 +Subject: [PATCH] iscsi: Always set auth info + +In case of reusing a context auth info needs to be +always set to override previous data. +--- + modules/iscsi/udisksiscsiutil.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/modules/iscsi/udisksiscsiutil.c b/modules/iscsi/udisksiscsiutil.c +index 8fdae889c7..78890106f0 100644 +--- a/modules/iscsi/udisksiscsiutil.c ++++ b/modules/iscsi/udisksiscsiutil.c +@@ -171,11 +171,8 @@ iscsi_perform_login_action (UDisksLinuxModuleISCSI *module, + /* Get a libiscsi context. */ + ctx = udisks_linux_module_iscsi_get_libiscsi_context (module); + +- if (action == ACTION_LOGIN && +- auth_info && auth_info->method == libiscsi_auth_chap) +- { +- libiscsi_node_set_auth (ctx, node, auth_info); +- } ++ if (action == ACTION_LOGIN && auth_info) ++ libiscsi_node_set_auth (ctx, node, auth_info); + + /* Login or Logout */ + err = action == ACTION_LOGIN ? diff --git a/SOURCES/udisks-2.10.0-iscsi_test_01_badauth.patch b/SOURCES/udisks-2.10.0-iscsi_test_01_badauth.patch new file mode 100644 index 0000000..48a41ff --- /dev/null +++ b/SOURCES/udisks-2.10.0-iscsi_test_01_badauth.patch @@ -0,0 +1,75 @@ +commit fab797fcf5e4c8e09e4cde45647951acd764415e +Author: Tomas Bzatek +Date: Mon Oct 10 13:58:15 2022 +0200 + + tests: Add bad auth test for iscsi + + This tests that the auth info is properly set for each login call, + overriding previously set auth info with no trace. + +diff --git a/src/tests/dbus-tests/test_30_iscsi.py b/src/tests/dbus-tests/test_30_iscsi.py +index 34bdfc4b..6ac8386b 100644 +--- a/src/tests/dbus-tests/test_30_iscsi.py ++++ b/src/tests/dbus-tests/test_30_iscsi.py +@@ -284,3 +284,61 @@ class UdisksISCSITest(udiskstestcase.UdisksTestCase): + # make sure the session object is no longer on dbus + objects = udisks.GetManagedObjects(dbus_interface='org.freedesktop.DBus.ObjectManager') + self.assertNotIn(session_path, objects.keys()) ++ ++ def test_login_noauth_badauth(self): ++ """ ++ Test auth info override ++ """ ++ manager = self.get_object('/Manager') ++ nodes, _ = manager.DiscoverSendTargets(self.address, self.port, self.no_options, ++ dbus_interface=self.iface_prefix + '.Manager.ISCSI.Initiator', ++ timeout=self.iscsi_timeout) ++ ++ node = next((node for node in nodes if node[0] == self.noauth_iqn), None) ++ self.assertIsNotNone(node) ++ ++ (iqn, tpg, host, port, iface) = node ++ self.assertEqual(iqn, self.noauth_iqn) ++ self.assertEqual(host, self.address) ++ self.assertEqual(port, self.port) ++ ++ self.addCleanup(self._force_lougout, self.noauth_iqn) ++ ++ # first attempt - wrong password ++ options = dbus.Dictionary(signature='sv') ++ options['username'] = self.initiator ++ msg = 'Login failed: initiator reported error' ++ with six.assertRaisesRegex(self, dbus.exceptions.DBusException, msg): ++ options['password'] = '12345' ++ manager.Login(iqn, tpg, host, port, iface, options, ++ dbus_interface=self.iface_prefix + '.Manager.ISCSI.Initiator', ++ timeout=self.iscsi_timeout) ++ ++ # second atttempt - no password ++ manager.Login(iqn, tpg, host, port, iface, self.no_options, ++ dbus_interface=self.iface_prefix + '.Manager.ISCSI.Initiator', ++ timeout=self.iscsi_timeout) ++ ++ devs = glob.glob('/dev/disk/by-path/*%s*' % iqn) ++ self.assertEqual(len(devs), 1) ++ ++ # check if the block device have 'Symlinks' property updated ++ disk_name = os.path.realpath(devs[0]).split('/')[-1] ++ disk_obj = self.get_object('/block_devices/' + disk_name) ++ dbus_path = str(disk_obj.object_path) ++ self.assertIsNotNone(disk_obj) ++ ++ symlinks = self.get_property_raw(disk_obj, '.Block', 'Symlinks') ++ self.assertIn(self.str_to_ay(devs[0]), symlinks) ++ ++ manager.Logout(iqn, tpg, host, port, iface, self.no_options, ++ dbus_interface=self.iface_prefix + '.Manager.ISCSI.Initiator', ++ timeout=self.iscsi_timeout) ++ ++ devs = glob.glob('/dev/disk/by-path/*%s*' % iqn) ++ self.assertEqual(len(devs), 0) ++ ++ # make sure the disk is no longer on dbus ++ udisks = self.get_object('') ++ objects = udisks.GetManagedObjects(dbus_interface='org.freedesktop.DBus.ObjectManager') ++ self.assertNotIn(dbus_path, objects.keys()) diff --git a/SOURCES/udisks-2.10.0-iscsi_test_02_lio_target_conf.patch b/SOURCES/udisks-2.10.0-iscsi_test_02_lio_target_conf.patch new file mode 100644 index 0000000..cf269a5 --- /dev/null +++ b/SOURCES/udisks-2.10.0-iscsi_test_02_lio_target_conf.patch @@ -0,0 +1,51 @@ +commit 13a6a27eecdd1fb527b9151309366970b182a58d +Author: Tomas Bzatek +Date: Thu Oct 20 17:17:10 2022 +0200 + + tests: Fix LIO target config auth + + Linux kernel 6.0 brought number of the LIO target changes related to authentication + that made our tests fail. Turned out our target config was incorrect, e.g. + not requiring auth for CHAP tests, etc. The kernel 6.0 looks to be more strict + in this regard. + +diff --git a/src/tests/dbus-tests/targetcli_config.json b/src/tests/dbus-tests/targetcli_config.json +index 25d506b6..3be9eac2 100644 +--- a/src/tests/dbus-tests/targetcli_config.json ++++ b/src/tests/dbus-tests/targetcli_config.json +@@ -385,7 +385,7 @@ + "tpgs": [ + { + "attributes": { +- "authentication": 0, ++ "authentication": 1, + "cache_dynamic_acls": 0, + "default_cmdsn_depth": 64, + "default_erl": 0, +@@ -432,7 +432,7 @@ + } + ], + "parameters": { +- "AuthMethod": "CHAP,None", ++ "AuthMethod": "CHAP", + "DataDigest": "CRC32C,None", + "DataPDUInOrder": "Yes", + "DataSequenceInOrder": "Yes", +@@ -471,7 +471,7 @@ + "tpgs": [ + { + "attributes": { +- "authentication": 0, ++ "authentication": 1, + "cache_dynamic_acls": 0, + "default_cmdsn_depth": 64, + "default_erl": 0, +@@ -520,7 +520,7 @@ + } + ], + "parameters": { +- "AuthMethod": "CHAP,None", ++ "AuthMethod": "CHAP", + "DataDigest": "CRC32C,None", + "DataPDUInOrder": "Yes", + "DataSequenceInOrder": "Yes", diff --git a/SOURCES/udisks-2.10.0-iscsi_test_03_iscsid_cache_clean.patch b/SOURCES/udisks-2.10.0-iscsi_test_03_iscsid_cache_clean.patch new file mode 100644 index 0000000..5473b8a --- /dev/null +++ b/SOURCES/udisks-2.10.0-iscsi_test_03_iscsid_cache_clean.patch @@ -0,0 +1,84 @@ +commit 68115b16181db7a38f852b101ec965b9fc3e59cb +Author: Tomas Bzatek +Date: Thu Oct 20 17:32:29 2022 +0200 + + tests: Clean the discovered test target iscsid node cache + + After each DiscoverSendTargets() and Login() calls iscsid caches + the node info in /var/lib/iscsi/nodes. That includes auth info and + passwords in plaintext. This might potentially lead to lingering + attributes sneaking into subsequent tests, affecting the results. + + Let's clean that after each test run. + +diff --git a/src/tests/dbus-tests/test_30_iscsi.py b/src/tests/dbus-tests/test_30_iscsi.py +index 6ac8386b..2b75462a 100644 +--- a/src/tests/dbus-tests/test_30_iscsi.py ++++ b/src/tests/dbus-tests/test_30_iscsi.py +@@ -6,6 +6,7 @@ import os + import re + import six + import time ++import shutil + import unittest + + +@@ -26,6 +27,7 @@ class UdisksISCSITest(udiskstestcase.UdisksTestCase): + chap_iqn = 'iqn.2003-01.udisks.test:iscsi-test-chap' + mutual_iqn = 'iqn.2003-01.udisks.test:iscsi-test-mutual' + ++ + # Define common D-Bus method call timeout that needs to be slightly longer + # than the corresponding timeout defined in libiscsi: + # #define ISCSID_REQ_TIMEOUT 1000 +@@ -61,6 +63,10 @@ class UdisksISCSITest(udiskstestcase.UdisksTestCase): + initiator = bytearray(data) + return initiator.strip().split(b"InitiatorName=")[1] + ++ def _clean_iscsid_node_dir(self): ++ for iqn in [self.noauth_iqn, self.chap_iqn, self.mutual_iqn]: ++ shutil.rmtree(os.path.join('/var/lib/iscsi/nodes/', iqn), ignore_errors=True) ++ + def test__manager_interface(self): + '''Test for module D-Bus Manager interface presence''' + +@@ -86,6 +92,7 @@ class UdisksISCSITest(udiskstestcase.UdisksTestCase): + nodes, _ = manager.DiscoverSendTargets(self.address, self.port, self.no_options, + dbus_interface=self.iface_prefix + '.Manager.ISCSI.Initiator', + timeout=self.iscsi_timeout) ++ self.addCleanup(self._clean_iscsid_node_dir) + + node = next((node for node in nodes if node[0] == self.noauth_iqn), None) + self.assertIsNotNone(node) +@@ -131,6 +138,7 @@ class UdisksISCSITest(udiskstestcase.UdisksTestCase): + nodes, _ = manager.DiscoverSendTargets(self.address, self.port, self.no_options, + dbus_interface=self.iface_prefix + '.Manager.ISCSI.Initiator', + timeout=self.iscsi_timeout) ++ self.addCleanup(self._clean_iscsid_node_dir) + + node = next((node for node in nodes if node[0] == self.chap_iqn), None) + self.assertIsNotNone(node) +@@ -190,6 +198,7 @@ class UdisksISCSITest(udiskstestcase.UdisksTestCase): + nodes, _ = manager.DiscoverSendTargets(self.address, self.port, self.no_options, + dbus_interface=self.iface_prefix + '.Manager.ISCSI.Initiator', + timeout=self.iscsi_timeout) ++ self.addCleanup(self._clean_iscsid_node_dir) + + node = next((node for node in nodes if node[0] == self.mutual_iqn), None) + self.assertIsNotNone(node) +@@ -246,6 +255,7 @@ class UdisksISCSITest(udiskstestcase.UdisksTestCase): + nodes, _ = manager.DiscoverSendTargets(self.address, self.port, self.no_options, + dbus_interface=self.iface_prefix + '.Manager.ISCSI.Initiator', + timeout=self.iscsi_timeout) ++ self.addCleanup(self._clean_iscsid_node_dir) + + node = next((node for node in nodes if node[0] == self.noauth_iqn), None) + self.assertIsNotNone(node) +@@ -293,6 +303,7 @@ class UdisksISCSITest(udiskstestcase.UdisksTestCase): + nodes, _ = manager.DiscoverSendTargets(self.address, self.port, self.no_options, + dbus_interface=self.iface_prefix + '.Manager.ISCSI.Initiator', + timeout=self.iscsi_timeout) ++ self.addCleanup(self._clean_iscsid_node_dir) + + node = next((node for node in nodes if node[0] == self.noauth_iqn), None) + self.assertIsNotNone(node) diff --git a/SOURCES/udisks-2.10.0-iscsi_test_04_fix_test_login_chap_auth.patch b/SOURCES/udisks-2.10.0-iscsi_test_04_fix_test_login_chap_auth.patch new file mode 100644 index 0000000..bf759fe --- /dev/null +++ b/SOURCES/udisks-2.10.0-iscsi_test_04_fix_test_login_chap_auth.patch @@ -0,0 +1,37 @@ +commit 1bf172603e4cc77da70d8fd13b6ba6c8b8c91600 +Author: Tomas Bzatek +Date: Thu Oct 20 17:53:20 2022 +0200 + + tests: Test iscsi noauth in test_login_chap_auth + + The other way is already tested in test_login_noauth_badauth. + +diff --git a/src/tests/dbus-tests/test_30_iscsi.py b/src/tests/dbus-tests/test_30_iscsi.py +index 2b75462a..f2594d99 100644 +--- a/src/tests/dbus-tests/test_30_iscsi.py ++++ b/src/tests/dbus-tests/test_30_iscsi.py +@@ -151,8 +151,14 @@ class UdisksISCSITest(udiskstestcase.UdisksTestCase): + options = dbus.Dictionary(signature='sv') + options['username'] = self.initiator + ++ msg = 'Login failed: initiator reported error \(24 - iSCSI login failed due to authorization failure\)' ++ # missing auth info ++ with six.assertRaisesRegex(self, dbus.exceptions.DBusException, msg): ++ manager.Login(iqn, tpg, host, port, iface, self.no_options, ++ dbus_interface=self.iface_prefix + '.Manager.ISCSI.Initiator', ++ timeout=self.iscsi_timeout) ++ + # wrong password +- msg = 'Login failed: initiator reported error' + with six.assertRaisesRegex(self, dbus.exceptions.DBusException, msg): + options['password'] = '12345' + manager.Login(iqn, tpg, host, port, iface, options, +@@ -318,7 +324,7 @@ class UdisksISCSITest(udiskstestcase.UdisksTestCase): + # first attempt - wrong password + options = dbus.Dictionary(signature='sv') + options['username'] = self.initiator +- msg = 'Login failed: initiator reported error' ++ msg = r'Login failed: initiator reported error \((19 - encountered non-retryable iSCSI login failure|24 - iSCSI login failed due to authorization failure)\)' + with six.assertRaisesRegex(self, dbus.exceptions.DBusException, msg): + options['password'] = '12345' + manager.Login(iqn, tpg, host, port, iface, options, diff --git a/SOURCES/udisks-2.10.0-iscsi_test_05_restart_iscsid.patch b/SOURCES/udisks-2.10.0-iscsi_test_05_restart_iscsid.patch new file mode 100644 index 0000000..eeb5e19 --- /dev/null +++ b/SOURCES/udisks-2.10.0-iscsi_test_05_restart_iscsid.patch @@ -0,0 +1,42 @@ +From fbe970add68e6d9d998fb7f78377368c403e200d Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Mon, 31 Oct 2022 15:15:31 +0100 +Subject: [PATCH] tests: Restart iscsid on every InitiatorName change + +The test LIO target config expects a specific initiator name as set +by the ACLs. However the iscsid daemon only seems to be reading +the InitiatorName string on startup and in case the service is running +with a different name, the auth tests will fail. + +As a workaround, restart the iscsid service after each change. +A proper way through libiscsi or libopeniscsiusr would be nice -> TODO. +--- + src/tests/dbus-tests/test_30_iscsi.py | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/src/tests/dbus-tests/test_30_iscsi.py b/src/tests/dbus-tests/test_30_iscsi.py +index f2594d992..09e975f30 100644 +--- a/src/tests/dbus-tests/test_30_iscsi.py ++++ b/src/tests/dbus-tests/test_30_iscsi.py +@@ -48,9 +48,21 @@ def _force_lougout(self, target): + def _set_initiator_name(self): + manager = self.get_object('/Manager') + ++ # make backup of INITIATOR_FILE and restore it at the end ++ try: ++ initiatorname_backup = self.read_file(INITIATOR_FILE) ++ self.addCleanup(self.write_file, INITIATOR_FILE, initiatorname_backup) ++ except FileNotFoundError as e: ++ # no existing file, simply remove it once finished ++ self.addCleanup(self.remove_file, INITIATOR_FILE, True) ++ + manager.SetInitiatorName(self.initiator, self.no_options, + dbus_interface=self.iface_prefix + '.Manager.ISCSI.Initiator') + ++ # running iscsid needs to be restarted to reflect the change ++ self.run_command('systemctl try-reload-or-restart iscsid.service') ++ # ignore the return code in case of non-systemd distros ++ + init = manager.GetInitiatorName(self.no_options, + dbus_interface=self.iface_prefix + '.Manager.ISCSI.Initiator') + self.assertEqual(init, self.initiator) diff --git a/SOURCES/udisks-2.10.0-lvm2_teardown_tests.patch b/SOURCES/udisks-2.10.0-lvm2_teardown_tests.patch new file mode 100644 index 0000000..016b9eb --- /dev/null +++ b/SOURCES/udisks-2.10.0-lvm2_teardown_tests.patch @@ -0,0 +1,182 @@ +From dd6ef8393a8f27fefad66cce136e52f13350f0df Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Fri, 1 Oct 2021 18:23:10 +0200 +Subject: [PATCH] tests: Add LVM2 teardown object existence checks + +This adds a check for the created stack objects presence after the teardown. + +Due to the nature of the global lvm2 module update some objects may still +hang around after the org.freedesktop.UDisks2.VolumeGroup.Delete(options='tear-down') +method call has returned. Until this is properly fixed an explicit timeout +had to be added. +--- + src/tests/dbus-tests/test_20_LVM.py | 80 +++++++++++++++++------------ + 1 file changed, 46 insertions(+), 34 deletions(-) + +diff --git a/src/tests/dbus-tests/test_20_LVM.py b/src/tests/dbus-tests/test_20_LVM.py +index 56915e580..7fbff0434 100644 +--- a/src/tests/dbus-tests/test_20_LVM.py ++++ b/src/tests/dbus-tests/test_20_LVM.py +@@ -3,6 +3,7 @@ + import re + import time + import unittest ++import six + + from distutils.version import LooseVersion + +@@ -637,7 +638,8 @@ def _remove_luks(self, device, name, close=True): + device.Lock(self.no_options, dbus_interface=self.iface_prefix + '.Encrypted') + except dbus.exceptions.DBusException as e: + # ignore when luks is actually already locked +- if not str(e).endswith('is not unlocked') and not 'No such interface' in str(e): ++ if not str(e).endswith('is not unlocked') and not 'No such interface' in str(e) and \ ++ not 'Object does not exist at path' in str(e): + raise e + + try: +@@ -645,7 +647,7 @@ def _remove_luks(self, device, name, close=True): + d['erase'] = True + device.Format('empty', d, dbus_interface=self.iface_prefix + '.Block') + except dbus.exceptions.DBusException as e: +- if not 'No such interface' in str(e): ++ if not 'No such interface' in str(e) and not 'Object does not exist at path' in str(e): + raise e + + def _init_stack(self, name): +@@ -663,18 +665,19 @@ def _init_stack(self, name): + self.assertIsNotNone(self.pv) + + self.vg = self._create_vg(vgname, dbus.Array([self.pv])) ++ self.vg_path = self.vg.object_path + self.addCleanup(self._remove_vg, self.vg, tear_down=True, ignore_removed=True) + + # create an LV on it +- lv_path = self.vg.CreatePlainVolume(lvname, dbus.UInt64(200 * 1024**2), self.no_options, +- dbus_interface=self.iface_prefix + '.VolumeGroup') +- self.lv = self.bus.get_object(self.iface_prefix, lv_path) ++ self.lv_path = self.vg.CreatePlainVolume(lvname, dbus.UInt64(200 * 1024**2), self.no_options, ++ dbus_interface=self.iface_prefix + '.VolumeGroup') ++ self.lv = self.bus.get_object(self.iface_prefix, self.lv_path) + self.assertIsNotNone(self.lv) + +- lv_block_path = self.lv.Activate(self.no_options, dbus_interface=self.iface_prefix + '.LogicalVolume') +- self.assertIsNotNone(lv_block_path) ++ self.lv_block_path = self.lv.Activate(self.no_options, dbus_interface=self.iface_prefix + '.LogicalVolume') ++ self.assertIsNotNone(self.lv_block_path) + +- self.lv_block = self.get_object(lv_block_path) ++ self.lv_block = self.get_object(self.lv_block_path) + self.assertIsNotNone(self.lv_block) + + # create LUKS on the LV +@@ -702,10 +705,10 @@ def _init_stack(self, name): + self.addCleanup(self._remove_luks, self.lv_block, vgname) + self.luks_uuid = self.get_property_raw(self.lv_block, '.Block', 'IdUUID') + +- luks_block_path = self.get_property(self.lv_block, '.Encrypted', 'CleartextDevice') +- self.luks_block = self.get_object(luks_block_path.value) +- self.assertIsNotNone(self.luks_block) +- self.fs_uuid = self.get_property_raw(self.luks_block, '.Block', 'IdUUID') ++ self.luks_block_path = self.get_property_raw(self.lv_block, '.Encrypted', 'CleartextDevice') ++ luks_block = self.get_object(self.luks_block_path) ++ self.assertIsNotNone(luks_block) ++ self.fs_uuid = self.get_property_raw(luks_block, '.Block', 'IdUUID') + + # check for present crypttab configuration item + conf = self.get_property(self.lv_block, '.Block', 'Configuration') +@@ -713,7 +716,7 @@ def _init_stack(self, name): + self.assertEqual(conf.value[0][0], 'crypttab') + + # check for present fstab configuration item on a cleartext block device +- conf = self.get_property(self.luks_block, '.Block', 'Configuration') ++ conf = self.get_property(luks_block, '.Block', 'Configuration') + conf.assertTrue() + self.assertEqual(conf.value[0][0], 'fstab') + +@@ -730,6 +733,32 @@ def _init_stack(self, name): + self.assertIn(vgname, fstab) + self.assertIn(self.fs_uuid, fstab) + ++ def _check_torn_down_stack(self, name): ++ # check that all created objects don't exist anymore ++ msg = r'Object does not exist at path|No such interface' ++ with six.assertRaisesRegex(self, dbus.exceptions.DBusException, msg): ++ luks_block = self.get_object(self.luks_block_path) ++ self.get_property_raw(luks_block, '.Block', 'DeviceNumber') ++ with six.assertRaisesRegex(self, dbus.exceptions.DBusException, msg): ++ lv_block = self.get_object(self.lv_block_path) ++ self.get_property_raw(lv_block, '.Block', 'DeviceNumber') ++ with six.assertRaisesRegex(self, dbus.exceptions.DBusException, msg): ++ # the lvm2 udisks module is not fully synchronous, see https://github.com/storaged-project/udisks/pull/814 ++ time.sleep(2) ++ lv = self.get_object(self.lv_path) ++ self.get_property_raw(lv, '.LogicalVolume', 'Name') ++ with six.assertRaisesRegex(self, dbus.exceptions.DBusException, msg): ++ vg = self.get_object(self.vg_path) ++ self.get_property_raw(vg, '.VolumeGroup', 'Name') ++ ++ # check that fstab and crypttab records have been removed ++ crypttab = self.read_file('/etc/crypttab') ++ self.assertNotIn(name, crypttab) ++ self.assertNotIn(self.luks_uuid, crypttab) ++ fstab = self.read_file('/etc/fstab') ++ self.assertNotIn(name, fstab) ++ self.assertNotIn(self.fs_uuid, fstab) ++ + + @udiskstestcase.tag_test(udiskstestcase.TestTags.UNSAFE) + def test_teardown_active_vg_unlocked(self): +@@ -741,13 +770,7 @@ def test_teardown_active_vg_unlocked(self): + + self._remove_vg(self.vg, tear_down=True, ignore_removed=False) + +- # check that fstab and crypttab records have been removed +- crypttab = self.read_file('/etc/crypttab') +- self.assertNotIn(name, crypttab) +- self.assertNotIn(self.luks_uuid, crypttab) +- fstab = self.read_file('/etc/fstab') +- self.assertNotIn(name, fstab) +- self.assertNotIn(self.fs_uuid, fstab) ++ self._check_torn_down_stack(name) + + @udiskstestcase.tag_test(udiskstestcase.TestTags.UNSAFE) + def test_teardown_active_vg_locked(self): +@@ -760,13 +783,7 @@ def test_teardown_active_vg_locked(self): + self.lv_block.Lock(self.no_options, dbus_interface=self.iface_prefix + '.Encrypted') + self._remove_vg(self.vg, tear_down=True, ignore_removed=False) + +- # check that fstab and crypttab records have been removed +- crypttab = self.read_file('/etc/crypttab') +- self.assertNotIn(name, crypttab) +- self.assertNotIn(self.luks_uuid, crypttab) +- fstab = self.read_file('/etc/fstab') +- self.assertNotIn(name, fstab) +- self.assertNotIn(self.fs_uuid, fstab) ++ self._check_torn_down_stack(name) + + @udiskstestcase.tag_test(udiskstestcase.TestTags.UNSAFE) + def test_teardown_inactive_vg_locked(self): +@@ -780,13 +797,7 @@ def test_teardown_inactive_vg_locked(self): + self.lv.Deactivate(self.no_options, dbus_interface=self.iface_prefix + '.LogicalVolume') + self._remove_vg(self.vg, tear_down=True, ignore_removed=False) + +- # check that fstab and crypttab records have been removed +- crypttab = self.read_file('/etc/crypttab') +- self.assertNotIn(name, crypttab) +- self.assertNotIn(self.luks_uuid, crypttab) +- fstab = self.read_file('/etc/fstab') +- self.assertNotIn(name, fstab) +- self.assertNotIn(self.fs_uuid, fstab) ++ self._check_torn_down_stack(name) + + @udiskstestcase.tag_test(udiskstestcase.TestTags.UNSAFE) + def test_reformat_inactive_vg_locked(self): +@@ -812,6 +823,7 @@ def test_reformat_inactive_vg_locked(self): + + # check that fstab and crypttab records have been removed + # TODO: these checks are the opposite - record shouldn't be present, once this is fixed ++ # self._check_torn_down_stack(name) + crypttab = self.read_file('/etc/crypttab') + self.assertIn(name, crypttab) + self.assertIn(self.luks_uuid, crypttab) diff --git a/SOURCES/udisks-2.10.0-static_daemon_resources_free.patch b/SOURCES/udisks-2.10.0-static_daemon_resources_free.patch new file mode 100644 index 0000000..1f35552 --- /dev/null +++ b/SOURCES/udisks-2.10.0-static_daemon_resources_free.patch @@ -0,0 +1,74 @@ +From d205057296957d6064825252a3d3377e809d6fed Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Wed, 6 Oct 2021 17:12:13 +0200 +Subject: [PATCH] udiskslinuxmountoptions: Do not free static daemon resources + +The GResource instance returned from udisks_daemon_resources_get_resource() +that calls g_static_resource_get_resource() internally is marked as +'(transfer none)' and should not be freed. In fact that causes double +free inside the g_static_resource_fini() atexit handler leading +to memory corruption causing random failures of further atexit +handlers such as cryptsetup and openssl destructors. + + Invalid read of size 4 + at 0x4BB03A4: g_resource_unref (gresource.c:527) + by 0x4BB2150: g_static_resource_fini (gresource.c:1449) + by 0x4010ADB: _dl_fini (dl-fini.c:139) + by 0x4EF0DF4: __run_exit_handlers (exit.c:113) + by 0x4EF0F6F: exit (exit.c:143) + by 0x4ED9566: __libc_start_call_main (libc_start_call_main.h:74) + by 0x4ED960B: __libc_start_main@@GLIBC_2.34 (libc-start.c:409) + by 0x128774: (below main) (in udisks/src/.libs/udisksd) + Address 0x5cc5fc0 is 0 bytes inside a block of size 16 free'd + at 0x48430E4: free (vg_replace_malloc.c:755) + by 0x4DB10BC: g_free (gmem.c:199) + by 0x4BB2148: g_static_resource_fini (gresource.c:1448) + by 0x4010ADB: _dl_fini (dl-fini.c:139) + by 0x4EF0DF4: __run_exit_handlers (exit.c:113) + by 0x4EF0F6F: exit (exit.c:143) + by 0x4ED9566: __libc_start_call_main (libc_start_call_main.h:74) + by 0x4ED960B: __libc_start_main@@GLIBC_2.34 (libc-start.c:409) + by 0x128774: (below main) (in udisks/src/.libs/udisksd) + Block was alloc'd at + at 0x484086F: malloc (vg_replace_malloc.c:380) + by 0x4DB47A8: g_malloc (gmem.c:106) + by 0x4BB19C7: UnknownInlinedFun (gresource.c:545) + by 0x4BB19C7: g_resource_new_from_data (gresource.c:613) + by 0x4BB1A88: register_lazy_static_resources_unlocked (gresource.c:1374) + by 0x4BB218C: UnknownInlinedFun (gresource.c:1393) + by 0x4BB218C: UnknownInlinedFun (gresource.c:1387) + by 0x4BB218C: g_static_resource_get_resource (gresource.c:1472) + by 0x14F6A3: UnknownInlinedFun (udisks-daemon-resources.c:284) + by 0x14F6A3: udisks_linux_mount_options_get_builtin (udiskslinuxmountoptions.c:612) + by 0x12CC6E: udisks_daemon_constructed (udisksdaemon.c:441) + by 0x4D1ED96: g_object_new_internal (gobject.c:1985) + by 0x4D20227: g_object_new_valist (gobject.c:2288) + by 0x4D2075C: g_object_new (gobject.c:1788) + by 0x129A5F: udisks_daemon_new (udisksdaemon.c:619) + by 0x129AD5: on_bus_acquired (main.c:63) + by 0x4C35C95: connection_get_cb.lto_priv.0 (gdbusnameowning.c:504) + by 0x4BD3F99: g_task_return_now (gtask.c:1219) + by 0x4BD419A: UnknownInlinedFun (gtask.c:1289) + by 0x4BD419A: g_task_return (gtask.c:1245) + by 0x4C31D51: bus_get_async_initable_cb (gdbusconnection.c:7433) + by 0x4BD3F99: g_task_return_now (gtask.c:1219) + by 0x4BD3FDC: complete_in_idle_cb (gtask.c:1233) + by 0x4DA852A: g_idle_dispatch (gmain.c:5897) + by 0x4DAC33E: UnknownInlinedFun (gmain.c:3381) + by 0x4DAC33E: g_main_context_dispatch (gmain.c:4099) +--- + src/udiskslinuxmountoptions.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/udiskslinuxmountoptions.c b/src/udiskslinuxmountoptions.c +index 7729d4015..819c9ba96 100644 +--- a/src/udiskslinuxmountoptions.c ++++ b/src/udiskslinuxmountoptions.c +@@ -614,7 +614,6 @@ udisks_linux_mount_options_get_builtin (void) + "/org/freedesktop/UDisks2/data/builtin_mount_options.conf", + G_RESOURCE_LOOKUP_FLAGS_NONE, + &error); +- g_resource_unref (daemon_resource); + + if (builtin_opts_bytes == NULL) + { diff --git a/SOURCES/udisks-2.10.0-vdo_test_writeAmplificationRatio.patch b/SOURCES/udisks-2.10.0-vdo_test_writeAmplificationRatio.patch new file mode 100644 index 0000000..e232e77 --- /dev/null +++ b/SOURCES/udisks-2.10.0-vdo_test_writeAmplificationRatio.patch @@ -0,0 +1,25 @@ +From 0edd6f5579c964323d86897aff9476c20d7901ba Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Mon, 22 Nov 2021 14:23:08 +0100 +Subject: [PATCH] tests: Do not check that writeAmplificationRatio is bigger + than 0 + +Apparently the bios_in_write value is now 0 for newly created VDO +pools and because we use it for the writeAmplificationRatio +calculation we get zero too. +--- + src/tests/dbus-tests/test_20_LVM.py | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/tests/dbus-tests/test_20_LVM.py b/src/tests/dbus-tests/test_20_LVM.py +index 7fbff0434..fde7c3f3f 100644 +--- a/src/tests/dbus-tests/test_20_LVM.py ++++ b/src/tests/dbus-tests/test_20_LVM.py +@@ -508,7 +508,6 @@ def test_create(self): + # get statistics and do some simple sanity check + stats = lv.GetStatistics(self.no_options, dbus_interface=self.iface_prefix + '.VDOVolume') + self.assertIn("writeAmplificationRatio", stats.keys()) +- self.assertGreater(float(stats["writeAmplificationRatio"]), 0) + + def test_enable_disable_compression_deduplication(self): + vgname = 'udisks_test_vdo_vg' diff --git a/SPECS/udisks2.spec b/SPECS/udisks2.spec new file mode 100644 index 0000000..aa3913a --- /dev/null +++ b/SPECS/udisks2.spec @@ -0,0 +1,681 @@ +%global glib2_version 2.50 +%global gobject_introspection_version 1.30.0 +%global polkit_version 0.102 +%global systemd_version 208 +%global libatasmart_version 0.17 +%global dbus_version 1.4.0 +%global with_gtk_doc 1 +%global libblockdev_version 2.25 + +%define with_bcache 1 +%define with_btrfs 1 +%define with_lsm 1 +%define with_zram 1 +%define with_lvmcache 1 + +# valid options are 'luks1' or 'luks2' +%define default_luks_encryption luks1 + +%define is_fedora 0%{?rhel} == 0 +%define is_git %(git show > /dev/null 2>&1 && echo 1 || echo 0) +%define git_hash %(git log -1 --pretty=format:"%h" || true) +%define build_date %(date '+%Y%m%d') + + +# bcache and zram are not available on RHEL +%if (0%{?rhel}) +%define with_bcache 0 +%define with_zram 0 +%endif + +# btrfs is not available on RHEL > 7 +%if 0%{?rhel} > 7 +%define with_btrfs 0 +%endif + +# feature parity with existing RHEL 7 packages +%if (0%{?rhel}) && (0%{?rhel} <= 7) +%define with_lsm 0 +%define with_lvmcache 0 +%endif + +# default to LUKS2 for RHEL > 7 +%if 0%{?rhel} > 7 +%define default_luks_encryption luks2 +%endif + + +Name: udisks2 +Summary: Disk Manager +Version: 2.9.4 +Release: 7%{?dist} +License: GPLv2+ +URL: https://github.com/storaged-project/udisks +Source0: https://github.com/storaged-project/udisks/releases/download/udisks-%{version}/udisks-%{version}.tar.bz2 +# https://github.com/storaged-project/udisks/pull/847 +Patch0: ignore-apple-boot-part.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=2001549 +Patch1: udisks-2.10.0-static_daemon_resources_free.patch +Patch2: udisks-2.10.0-lvm2_teardown_tests.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=2030916 +Patch3: udisks-2.10.0-vdo_test_writeAmplificationRatio.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=2120329 +Patch4: udisks-2.10.0-block_format_ata_secure_erase.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1983602 +Patch5: udisks-2.10.0-iscsi-auth-info.patch + +# https://bugzilla.redhat.com/show_bug.cgi?id=2136557 +Patch10: udisks-2.10.0-iscsi_test_01_badauth.patch +Patch11: udisks-2.10.0-iscsi_test_02_lio_target_conf.patch +Patch12: udisks-2.10.0-iscsi_test_03_iscsid_cache_clean.patch +Patch13: udisks-2.10.0-iscsi_test_04_fix_test_login_chap_auth.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1958932 +Patch14: udisks-2.10.0-iscsi_test_05_restart_iscsid.patch + +BuildRequires: make +BuildRequires: glib2-devel >= %{glib2_version} +BuildRequires: gobject-introspection-devel >= %{gobject_introspection_version} +BuildRequires: libgudev1-devel >= %{systemd_version} +BuildRequires: libatasmart-devel >= %{libatasmart_version} +BuildRequires: polkit-devel >= %{polkit_version} +BuildRequires: systemd >= %{systemd_version} +BuildRequires: systemd-devel >= %{systemd_version} +BuildRequires: libacl-devel +BuildRequires: chrpath +BuildRequires: gtk-doc +BuildRequires: gettext-devel +BuildRequires: redhat-rpm-config +BuildRequires: libblockdev-devel >= %{libblockdev_version} +BuildRequires: libblockdev-part-devel >= %{libblockdev_version} +BuildRequires: libblockdev-loop-devel >= %{libblockdev_version} +BuildRequires: libblockdev-swap-devel >= %{libblockdev_version} +BuildRequires: libblockdev-mdraid-devel >= %{libblockdev_version} +BuildRequires: libblockdev-fs-devel >= %{libblockdev_version} +BuildRequires: libblockdev-crypto-devel >= %{libblockdev_version} +BuildRequires: libmount-devel +BuildRequires: libuuid-devel + +Requires: libblockdev >= %{libblockdev_version} +Requires: libblockdev-part >= %{libblockdev_version} +Requires: libblockdev-loop >= %{libblockdev_version} +Requires: libblockdev-swap >= %{libblockdev_version} +Requires: libblockdev-mdraid >= %{libblockdev_version} +Requires: libblockdev-fs >= %{libblockdev_version} +Requires: libblockdev-crypto >= %{libblockdev_version} + +# Needed for the systemd-related macros used in this file +%{?systemd_requires} +BuildRequires: systemd + +# Needed to pull in the system bus daemon +Requires: dbus >= %{dbus_version} +# Needed to pull in the udev daemon +Requires: udev >= %{systemd_version} +# We need at least this version for bugfixes/features etc. +Requires: libatasmart >= %{libatasmart_version} +# For mount, umount, mkswap +Requires: util-linux +# For mkfs.ext3, mkfs.ext3, e2label +Requires: e2fsprogs +# For mkfs.xfs, xfs_admin +Requires: xfsprogs +# For mkfs.vfat +Requires: dosfstools +Requires: gdisk +# For ejecting removable disks +Requires: eject +# For utab monitor +Requires: libmount + +%if ! (0%{?rhel} && 0%{?rhel} < 8) +# Not really needed but doesn't make much sense to use UDisks without polkit +# (weak deps don't work on older versions of RHEL) +Recommends: polkit +%endif + +Requires: lib%{name}%{?_isa} = %{version}-%{release} + +# For mkntfs (not available on rhel or on ppc/ppc64) +%if ! 0%{?rhel} +%ifnarch ppc ppc64 +Requires: ntfsprogs +%endif +%endif + +# For /proc/self/mountinfo, only available in 2.6.26 or higher +Conflicts: kernel < 2.6.26 + +Provides: storaged = %{version}-%{release} +Obsoletes: storaged + +%description +The Udisks project provides a daemon, tools and libraries to access and +manipulate disks, storage devices and technologies. + +%package -n lib%{name} +Summary: Dynamic library to access the udisksd daemon +License: LGPLv2+ +Provides: libstoraged = %{version}-%{release} +Obsoletes: libstoraged + +%description -n lib%{name} +This package contains the dynamic library, which provides +access to the udisksd daemon. + +%package -n %{name}-iscsi +Summary: Module for iSCSI +Requires: %{name}%{?_isa} = %{version}-%{release} +License: LGPLv2+ +Requires: iscsi-initiator-utils +BuildRequires: iscsi-initiator-utils-devel +Provides: storaged-iscsi = %{version}-%{release} +Obsoletes: storaged-iscsi + +%description -n %{name}-iscsi +This package contains module for iSCSI configuration. + +%package -n %{name}-lvm2 +Summary: Module for LVM2 +Requires: %{name}%{?_isa} = %{version}-%{release} +License: LGPLv2+ +Requires: lvm2 +Requires: libblockdev-lvm >= %{libblockdev_version} +BuildRequires: lvm2-devel +BuildRequires: libblockdev-lvm-devel >= %{libblockdev_version} +Provides: storaged-lvm2 = %{version}-%{release} +Obsoletes: storaged-lvm2 + +%description -n %{name}-lvm2 +This package contains module for LVM2 configuration. + +%package -n lib%{name}-devel +Summary: Development files for lib%{name} +Requires: lib%{name}%{?_isa} = %{version}-%{release} +License: LGPLv2+ +Provides: libstoraged-devel = %{version}-%{release} +Obsoletes: libstoraged-devel + +%description -n lib%{name}-devel +This package contains the development files for the library lib%{name}, a +dynamic library, which provides access to the udisksd daemon. + +%if 0%{?with_bcache} +%package -n %{name}-bcache +Summary: Module for Bcache +Requires: %{name}%{?_isa} = %{version}-%{release} +License: LGPLv2+ +Requires: libblockdev-kbd >= %{libblockdev_version} +BuildRequires: libblockdev-kbd-devel >= %{libblockdev_version} +Provides: storaged-bcache = %{version}-%{release} +Obsoletes: storaged-bcache + +%description -n %{name}-bcache +This package contains module for Bcache configuration. +%endif + +%if 0%{?with_btrfs} +%package -n %{name}-btrfs +Summary: Module for BTRFS +Requires: %{name}%{?_isa} = %{version}-%{release} +License: LGPLv2+ +Requires: libblockdev-btrfs >= %{libblockdev_version} +BuildRequires: libblockdev-btrfs-devel >= %{libblockdev_version} +Provides: storaged-btrfs = %{version}-%{release} +Obsoletes: storaged-btrfs + +%description -n %{name}-btrfs +This package contains module for BTRFS configuration. +%endif + +%if 0%{?with_lsm} +%package -n %{name}-lsm +Summary: Module for LSM +Requires: %{name}%{?_isa} = %{version}-%{release} +License: LGPLv2+ +Requires: libstoragemgmt +BuildRequires: libstoragemgmt-devel +BuildRequires: libconfig-devel +Provides: storaged-lsm = %{version}-%{release} +Obsoletes: storaged-lsm + +%description -n %{name}-lsm +This package contains module for LSM configuration. +%endif + +%if 0%{?with_zram} +%package -n %{name}-zram +Summary: Module for ZRAM +Requires: %{name}%{?_isa} = %{version}-%{release} +License: LGPLv2+ +Requires: libblockdev-kbd >= %{libblockdev_version} +Requires: libblockdev-swap >= %{libblockdev_version} +BuildRequires: libblockdev-kbd-devel >= %{libblockdev_version} +BuildRequires: libblockdev-swap-devel +Provides: storaged-zram = %{version}-%{release} +Obsoletes: storaged-zram + +%description -n %{name}-zram +This package contains module for ZRAM configuration. +%endif + +%prep +%autosetup -p1 -n udisks-%{version} +sed -i udisks/udisks2.conf.in -e "s/encryption=luks1/encryption=%{default_luks_encryption}/" +rm -f src/tests/dbus-tests/config_h.py + +%build +autoreconf -ivf +# modules need to be explicitly enabled +%configure \ +%if %{with_gtk_doc} + --enable-gtk-doc \ +%else + --disable-gtk-doc \ +%endif +%if 0%{?with_bcache} + --enable-bcache \ +%endif +%if 0%{?with_btrfs} + --enable-btrfs \ +%endif + --disable-vdo \ +%if 0%{?with_zram} + --enable-zram \ +%endif +%if 0%{?with_lsm} + --enable-lsm \ +%endif +%if 0%{?with_lvmcache} + --enable-lvmcache \ +%endif + --enable-lvm2 \ + --enable-iscsi +make %{?_smp_mflags} + +%install +make install DESTDIR=%{buildroot} +%if %{with_gtk_doc} == 0 +rm -fr %{buildroot}/%{_datadir}/gtk-doc/html/udisks2 +%endif + +find %{buildroot} -name \*.la -o -name \*.a | xargs rm + +chrpath --delete %{buildroot}/%{_sbindir}/umount.udisks2 +chrpath --delete %{buildroot}/%{_bindir}/udisksctl +chrpath --delete %{buildroot}/%{_libexecdir}/udisks2/udisksd + +%find_lang udisks2 + +%post -n %{name} +%systemd_post udisks2.service +# skip retriggering if udevd isn't even accessible, e.g. containers or +# rpm-ostree-based systems +if [ -S /run/udev/control ]; then + udevadm control --reload + udevadm trigger +fi + +%preun -n %{name} +%systemd_preun udisks2.service + +%postun -n %{name} +%systemd_postun_with_restart udisks2.service + +%ldconfig_scriptlets -n lib%{name} + +%if 0%{?with_zram} +%post -n %{name}-zram +%systemd_post udisks2-zram-setup@.service +if [ -S /run/udev/control ]; then + udevadm control --reload + udevadm trigger +fi + +%preun -n %{name}-zram +%systemd_preun udisks2-zram-setup@.service + +%postun -n %{name}-zram +%systemd_postun udisks2-zram-setup@.service +%endif + +%files -f udisks2.lang +%doc README.md AUTHORS NEWS HACKING +%license COPYING + +%dir %{_sysconfdir}/udisks2 +%if %{is_fedora} +%dir %{_sysconfdir}/udisks2/modules.conf.d +%endif +%{_sysconfdir}/udisks2/udisks2.conf +%{_sysconfdir}/udisks2/mount_options.conf.example + +%{_datadir}/dbus-1/system.d/org.freedesktop.UDisks2.conf +%{_datadir}/bash-completion/completions/udisksctl +%{_tmpfilesdir}/%{name}.conf +%{_unitdir}/udisks2.service +%{_udevrulesdir}/80-udisks2.rules +%{_sbindir}/umount.udisks2 + + +%dir %{_libdir}/udisks2 +%dir %{_libdir}/udisks2/modules +%dir %{_libexecdir}/udisks2 +%{_libexecdir}/udisks2/udisksd + +%{_bindir}/udisksctl + +%{_mandir}/man1/udisksctl.1* +%{_mandir}/man5/udisks2.conf.5* +%{_mandir}/man8/udisksd.8* +%{_mandir}/man8/udisks.8* +%{_mandir}/man8/umount.udisks2.8* + +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.policy +%{_datadir}/dbus-1/system-services/org.freedesktop.UDisks2.service + +# Permissions for local state data are 0700 to avoid leaking information +# about e.g. mounts to unprivileged users +%attr(0700,root,root) %dir %{_localstatedir}/lib/udisks2 + +%files -n lib%{name} +%{_libdir}/libudisks2.so.* +%{_libdir}/girepository-1.0/UDisks-2.0.typelib + +%files -n %{name}-lvm2 +%{_libdir}/udisks2/modules/libudisks2_lvm2.so +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.lvm2.policy + +%files -n %{name}-iscsi +%{_libdir}/udisks2/modules/libudisks2_iscsi.so +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.iscsi.policy + +%files -n lib%{name}-devel +%{_libdir}/libudisks2.so +%dir %{_includedir}/udisks2 +%dir %{_includedir}/udisks2/udisks +%{_includedir}/udisks2/udisks/*.h +%{_datadir}/gir-1.0/UDisks-2.0.gir +%if %{with_gtk_doc} +%dir %{_datadir}/gtk-doc/html/udisks2 +%{_datadir}/gtk-doc/html/udisks2/* +%endif +%{_libdir}/pkgconfig/udisks2.pc +%{_libdir}/pkgconfig/udisks2-lvm2.pc +%{_libdir}/pkgconfig/udisks2-iscsi.pc +%if 0%{?with_bcache} +%{_libdir}/pkgconfig/udisks2-bcache.pc +%endif +%if 0%{?with_btrfs} +%{_libdir}/pkgconfig/udisks2-btrfs.pc +%endif +%if 0%{?with_lsm} +%{_libdir}/pkgconfig/udisks2-lsm.pc +%endif +%if 0%{?with_zram} +%{_libdir}/pkgconfig/udisks2-zram.pc +%endif + +%if 0%{?with_bcache} +%files -n %{name}-bcache +%{_libdir}/udisks2/modules/libudisks2_bcache.so +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.bcache.policy +%endif + +%if 0%{?with_btrfs} +%files -n %{name}-btrfs +%{_libdir}/udisks2/modules/libudisks2_btrfs.so +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.btrfs.policy +%endif + +%if 0%{?with_lsm} +%files -n %{name}-lsm +%dir %{_sysconfdir}/udisks2/modules.conf.d +%{_libdir}/udisks2/modules/libudisks2_lsm.so +%{_mandir}/man5/udisks2_lsm.conf.* +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.lsm.policy +%attr(0600,root,root) %{_sysconfdir}/udisks2/modules.conf.d/udisks2_lsm.conf +%endif + +%if 0%{?with_zram} +%files -n %{name}-zram +%dir %{_sysconfdir}/udisks2/modules.conf.d +%{_libdir}/udisks2/modules/libudisks2_zram.so +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.zram.policy +%{_unitdir}/udisks2-zram-setup@.service +%{_udevrulesdir}/90-udisks2-zram.rules +%endif + +%changelog +* Tue Nov 01 2022 Tomas Bzatek - 2.9.4-7 +- Fix iscsi test auth failures (#1958932) + +* Fri Oct 21 2022 Tomas Bzatek - 2.9.4-6 +- Fix iscsi test LIO target config (#2136557) + +* Wed Oct 19 2022 Tomas Bzatek - 2.9.4-5 +- Fix iscsi authentication info override (#1983602) + +* Fri Sep 16 2022 Tomas Bzatek - 2.9.4-4 +- Restrict ATA Secure Erase Format() options (#2120329) + +* Tue Feb 01 2022 Tomas Bzatek - 2.9.4-3 +- Fix LVM-VDO statistics tests (#2030916) + +* Tue Oct 26 2021 Tomas Bzatek - 2.9.4-2 +- Gating test fix + +* Tue Oct 26 2021 Tomas Bzatek - 2.9.4-1 +- Version 2.9.4 (#2010363) +- CVE-2021-3802: Harden the default mount options for ext filesystems (#2004423) +- Fix double free on daemon exit (unaligned fastbin chunk) (#2001549) + +* Tue Aug 10 2021 Mohan Boddu - 2.9.2-6 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Thu Apr 22 2021 Tomas Bzatek - 2.9.2-5 +- Fix Drive.ATA test failures + +* Tue Apr 20 2021 Tomas Bzatek - 2.9.2-4 +- Fix a couple of issues found by Coverity (#1938890) +- Ignore systemd "Extended Boot Loader" GPT partition + +* Fri Apr 16 2021 Mohan Boddu - 2.9.2-3 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Fri Mar 26 2021 Tomas Bzatek - 2.9.2-2 +- Fix FAT mkfs with dosfstools >= 4.2 +- udiskslinuxdriveata: Use GTask to apply configuration in a thread +- Limit allowed module names +- 80-udisks2.rules: Ignore Apple boot partition from livecd-tools + +* Thu Feb 04 2021 Tomas Bzatek - 2.9.2-1 +- Version 2.9.2 + +* Wed Jan 27 2021 Fedora Release Engineering - 2.9.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Mon Sep 07 2020 Neal Gompa - 2.9.1-2 +- Fix conditional around polkit Recommends for building on EL7 + +* Wed Aug 12 2020 Tomas Bzatek - 2.9.1-1 +- Version 2.9.1 +- Renamed zram-setup@.service to udisks2-zram-setup@.service + +* Wed Jul 29 2020 Fedora Release Engineering - 2.9.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue May 26 2020 Tomas Bzatek - 2.9.0-1 +- Version 2.9.0 + +* Fri Jan 31 2020 Fedora Release Engineering - 2.8.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Tue Oct 01 2019 Jonathan Lebon - 2.8.4-3 +- Don't trigger udev if socket is not accessible + +* Sat Jul 27 2019 Fedora Release Engineering - 2.8.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon Jul 22 2019 Tomas Bzatek - 2.8.4-1 +- Version 2.8.4 + +* Thu Jun 13 2019 Tomas Bzatek - 2.8.3-1 +- Version 2.8.3 + +* Fri Mar 15 2019 Debarshi Ray - 2.8.2-2 +- Update for tmpfiles.d snippet + +* Mon Mar 04 2019 Tomas Bzatek - 2.8.2-1 +- Version 2.8.2 + +* Sun Feb 03 2019 Fedora Release Engineering - 2.8.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Wed Sep 26 2018 Vojtech Trefny - 2.8.1-1 +- Version 2.8.1 + +* Fri Sep 14 2018 Adam Williamson - 2.8.0-2 +- Backport PR #576 to fix udev multipath device check (see RHBZ#1628192) + +* Mon Aug 13 2018 Tomas Bzatek - 2.8.0-1 +- Version 2.8.0 + +* Tue Jul 24 2018 Adam Williamson - 2.7.7-3 +- Rebuild for new libconfig + +* Sat Jul 14 2018 Fedora Release Engineering - 2.7.7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed Jul 04 2018 Vojtech Trefny - 2.7.7-1 +- Version 2.7.7 + +* Thu Feb 08 2018 Vojtech Trefny - 2.7.6-1 +- Version 2.7.6 + +* Fri Feb 02 2018 Igor Gnatenko - 2.7.5-2 +- Switch to %%ldconfig_scriptlets + +* Mon Dec 04 2017 Vojtech Trefny - 2.7.5-1 +- Version 2.7.5 + +* Wed Nov 01 2017 Vojtech Trefny - 2.7.4-1 +- Version 2.7.4 + +* Thu Aug 31 2017 Vojtech Trefny - 2.7.3-1 +- Version 2.7.3 + +* Thu Aug 03 2017 Vojtech Trefny - 2.7.2-1 +- Version 2.7.2 + +* Thu Aug 03 2017 Fedora Release Engineering - 2.7.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 2.7.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Mon Jul 03 2017 Vojtech Trefny - 2.7.1-1 +- Version 2.7.1 + +* Tue Jun 20 2017 Vojtech Trefny - 2.7.0-3 +- Do not try to remove changed_blacklist hash table in finalize + +* Mon Jun 19 2017 Vojtech Trefny - 2.7.0-2 +- Fix how UDisksClient filters property changes + +* Fri Jun 02 2017 Vojtech Trefny - 2.7.0-1 +- Version 2.7.0 + +* Mon May 15 2017 Vojtech Trefny - 2.6.5-1 +- Version 2.6.5 + +* Tue Mar 14 2017 Vojtech Trefny - 2.6.4-1 +- Version 2.6.4 + +* Mon Nov 14 2016 Tomas Smetana - 2.6.3-1 +- Version 2.6.3 + +* Thu Jun 16 2016 Tomas Smetana - 2.6.2-1 +- Version 2.6.2; aimed to replace udisks2 + +* Wed Apr 27 2016 Peter Hatina - 2.6.0-3 +- Add support for libblockdev-part plugin which replaces + parted calls + +* Wed Mar 16 2016 Peter Hatina - 2.6.0-2 +- Fix permissions set for storaged_lsm.conf so it is readable only by root + +* Mon Mar 14 2016 Peter Hatina - 2.6.0-1 +- Upgrade to 2.6.0 + +* Wed Feb 10 2016 Peter Hatina - 2.5.0-3 +- Package template zram-setup@.service file + +* Wed Feb 10 2016 Peter Hatina - 2.5.0-2 +- Add udisksd configuration file and its man page + +* Thu Jan 28 2016 Peter Hatina - 2.5.0-1 +- UDisks2 drop-in replacement + +* Thu Jan 21 2016 Peter Hatina - 2.4.0-3 +- Redesign subpackage dependencies +- Make GTK documentation generation configurable + +* Wed Jan 20 2016 Peter Hatina - 2.4.0-2 +- Reload udev rules and trigger events when installed + +* Wed Jan 13 2016 Peter Hatina - 2.4.0-1 +- Upgrade to 2.4.0 + +* Wed Sep 30 2015 Peter Hatina - 2.3.0-2 +- Add Fedora/RHEL package configuration options + +* Mon Sep 14 2015 Peter Hatina - 2.3.0-1 +- Change BuildRequires from pkgconfig macro to -devel packages +- Upgrade to 2.3.0 + +* Mon Aug 24 2015 Peter Hatina - 2.2.0-1 +- Upgrade to 2.2.0 + +* Fri Jul 3 2015 Peter Hatina - 2.1.1-1 +- Upgrade to 2.1.1 + +* Wed Jun 24 2015 Peter Hatina - 2.1.0-4 +- Add Requires for storaged modules + +* Wed Jun 24 2015 Peter Hatina - 2.1.0-3 +- Changes for EPEL-7 + - Lower systemd required version to 208 + - Rewrite BuildRequires for systemd-devel + +* Fri Jun 19 2015 Fedora Release Engineering - 2.1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Thu Jun 11 2015 Peter Hatina - 2.1.0-1 +- Update to upstream 2.1.0 + +* Thu Apr 02 2015 Peter Hatina - 2.0.0-1 +- Rebase to the new Storaged implementation +- Upstream: https://storaged.org + +* Tue Sep 16 2014 Stef Walter - 0.3.1-1 +- Update to upstream 0.3.1 + +* Mon Aug 18 2014 Fedora Release Engineering - 0.3.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sun Jun 08 2014 Fedora Release Engineering - 0.3.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Tue Apr 08 2014 Patrick Uiterwijk - 0.3.0-1 +- Update to upstream 0.3.0 + +* Fri Jan 31 2014 Patrick Uiterwijk - 0.2.0-1 +- Update to upstream 0.2.0 + +* Thu Jan 16 2014 Patrick Uiterwijk - 0.1.0-2 +- Removed double systemd BuildRequire +- Rewritten summary and description + +* Sun Jan 12 2014 Patrick Uiterwijk - 0.1.0-1 +- Rename from udisks2-lvm