[Pkg-utopia-maintainers] Bug#987678: unblock: udisks2/2.9.2-2
Michael Biebl
biebl at debian.org
Tue Apr 27 17:41:42 BST 2021
Package: release.debian.org
Severity: normal
User: release.debian.org at packages.debian.org
Usertags: unblock
X-Debbugs-Cc: pkg-utopia-maintainers at lists.alioth.debian.org
Please unblock package udisks2
It fixes #987582:
udisks_client_get_block_for_drive() always returns the wrong block of eMMC
It's an upstream cherry-pick which ensure eMMC block devices are
detected correctly.
[ Tests ]
No automated tests for this code, but the fix was confirmed by the
original bug submitter.
[ Risks ]
udisks2 is a key package, but the change is rather small, see
https://github.com/storaged-project/udisks/commit/5d0ac7ebefb8b7aad73871936f5011545cc66344
[ Checklist ]
[x] all changes are documented in the d/changelog
[x] I reviewed all changes and I approve them
[x] attach debdiff against the package in testing
[ Other info ]
unblock udisks2/2.9.2-2
-------------- next part --------------
diff --git a/debian/changelog b/debian/changelog
index fabe2505..51c3b887 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+udisks2 (2.9.2-2) unstable; urgency=medium
+
+ * udisksclient: Make get_block_for_drive deterministic.
+ Fixes "udisks_client_get_block_for_drive() always returns the wrong
+ block of eMMC". (Closes: #987582)
+
+ -- Michael Biebl <biebl at debian.org> Mon, 26 Apr 2021 21:12:10 +0200
+
udisks2 (2.9.2-1) unstable; urgency=medium
* New upstream version 2.9.2
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 00000000..b5f3547a
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+udisksclient-Make-get_block_for_drive-deterministic.patch
diff --git a/debian/patches/udisksclient-Make-get_block_for_drive-deterministic.patch b/debian/patches/udisksclient-Make-get_block_for_drive-deterministic.patch
new file mode 100644
index 00000000..e33737f0
--- /dev/null
+++ b/debian/patches/udisksclient-Make-get_block_for_drive-deterministic.patch
@@ -0,0 +1,71 @@
+From: Will Thompson <wjt at endlessos.org>
+Date: Wed, 21 Apr 2021 10:56:30 +0100
+Subject: udisksclient: Make get_block_for_drive deterministic
+
+While any given Block object has at most one corresponding Drive, many
+Block objects may share the same Drive. One example is eMMC devices
+which provide a block device for the main data area (e.g. /dev/mmcblk0)
+as well as additional logical block devices for device partitions (e.g.
+/dev/mmcblk0boot0 and /dev/mmcblk0boot1).
+
+This behaviour was introduced in #834 to resolve issue #619 that these
+device partitions caused a phantom additional Drive object to be
+exposed. On that issue, I wrote:
+
+> I believe that Block.Drive on the boot partitions should point to the
+> same data area as the main data area (and its logical partitions);
+> udisks_client_get_block_for_drive() on the drive should return
+> /org/freedesktop/UDisks2/block_devices/mmcblk0.
+
+The first part is now true, but as described on #879 the second part is
+not true. It is now non-deterministic which Block will be returned,
+based only on the order of objects returned by
+g_dbus_object_manager_get_objects().
+
+Make the return value of udisks_client_get_block_for_drive()
+deterministic by sorting the list of candidate Block objects by their
+device path in lexicographic order. Since (e.g.) /dev/mmcblk0 sorts
+before /dev/mmcblk0boot0, this has the desirable side-effect that
+calling udisks_client_get_block_for_drive() on an eMMC Drive returns the
+'real' Block for the main data area.
+
+Fixes #879.
+
+(cherry picked from commit 5d0ac7ebefb8b7aad73871936f5011545cc66344)
+---
+ udisks/udisksclient.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/udisks/udisksclient.c b/udisks/udisksclient.c
+index 463b15a..1855209 100644
+--- a/udisks/udisksclient.c
++++ b/udisks/udisksclient.c
+@@ -816,6 +816,20 @@ udisks_client_get_block_for_dev (UDisksClient *client,
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
++static int
++compare_blocks_by_device (gconstpointer a,
++ gconstpointer b)
++{
++ UDisksBlock *block_a = udisks_object_get_block (UDISKS_OBJECT (a));
++ UDisksBlock *block_b = udisks_object_get_block (UDISKS_OBJECT (b));
++
++ g_assert (block_a != NULL);
++ g_assert (block_b != NULL);
++
++ return g_strcmp0 (udisks_block_get_device (block_a),
++ udisks_block_get_device (block_b));
++}
++
+ static GList *
+ get_top_level_blocks_for_drive (UDisksClient *client,
+ const gchar *drive_object_path)
+@@ -847,6 +861,7 @@ get_top_level_blocks_for_drive (UDisksClient *client,
+ }
+ g_object_unref (block);
+ }
++ ret = g_list_sort (ret, compare_blocks_by_device);
+ g_list_free_full (object_proxies, g_object_unref);
+ return ret;
+ }
More information about the Pkg-utopia-maintainers
mailing list