#775739 grub-pc: bug in postinst usable_partitions

Package:
grub-pc
Source:
grub2
Description:
GRand Unified Bootloader, version 2 (PC/BIOS version)
Submitter:
Dietmar Maurer
Date:
2015-01-19 12:42:06 UTC
Severity:
normal
#775739#5
Date:
2015-01-19 12:31:36 UTC
From:
To:
I am testing with zfs on /, and I get the following output with grub-probe:

# grub-probe -t device /
/dev/sda3
/dev/sdb1
/dev/sdc1

but usable_partitions() expect to get a single device.

The following patch fixes the issue:

Index: new/debian/postinst.in
===================================================================
--- new.orig/debian/postinst.in 2014-12-22 12:55:53.000000000 +0100
+++ new/debian/postinst.in      2015-01-19 12:20:20.000000000 +0100
@@ -265,8 +265,13 @@
     if [ -z "$partition" ] || [ "$partition" = "$last_partition" ]; then
       continue
     fi
-    partition_id="$(device_to_id "$partition" || true)"
-    echo "$path:$partition_id"
+    for dev in $partition; do
+       partition_id="$(device_to_id "$dev" || true)"
+       if [ -z "$partition_id" ]; then
+           continue;
+       fi
+       echo "$dev:$partition_id"
+    done
     last_partition="$partition"
   done | sort -t: -k2
 }