diff -Nru grub2-2.02~beta2/debian/changelog grub2-2.02~beta2/debian/changelog --- grub2-2.02~beta2/debian/changelog 2015-12-03 15:23:24.000000000 -0500 +++ grub2-2.02~beta2/debian/changelog 2015-12-25 09:54:13.000000000 -0500 @@ -1,3 +1,12 @@ +grub2 (2.02~beta2-32ubuntu2) xenial; urgency=medium + + * debian/patches/grubprobe-zfspool-device-name-prepend: Don't always + qualify device names with "/dev/" that we get from "zpool status". + People can (and should!) use /dev/disk/ paths. Given an unqualified name, + search where name actually exists before using it. (LP: #1527727) + + -- Chad MILLER Fri, 25 Dec 2015 09:49:08 -0500 + grub2 (2.02~beta2-32ubuntu1) xenial; urgency=medium * Cherry-picks to better handle TFTP timeouts on some arches: (LP: #1521612) diff -Nru grub2-2.02~beta2/debian/patches/grubprobe-zfspool-device-name-prepend grub2-2.02~beta2/debian/patches/grubprobe-zfspool-device-name-prepend --- grub2-2.02~beta2/debian/patches/grubprobe-zfspool-device-name-prepend 1969-12-31 19:00:00.000000000 -0500 +++ grub2-2.02~beta2/debian/patches/grubprobe-zfspool-device-name-prepend 2015-12-25 09:48:31.000000000 -0500 @@ -0,0 +1,37 @@ +Description: Test several locations for the name returned in polling zpool + devices. +Author: Chad Miller +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1527727 + +--- a/grub-core/osdep/unix/getroot.c ++++ b/grub-core/osdep/unix/getroot.c +@@ -303,11 +303,24 @@ grub_util_find_root_devices_from_poolnam + devices = xrealloc (devices, sizeof (devices[0]) + * devices_allocated); + } +- if (name[0] == '/') +- devices[ndevices++] = xstrdup (name); +- else +- devices[ndevices++] = xasprintf ("/dev/%s", name); +- } ++ if (name[0] == '/') { ++ devices[ndevices++] = xstrdup (name); ++ } else { ++ const char *middles[] = { "disk/by-id/", "disk/by-uuid/", "disk/by-partuuid/", "disk/by-label/", "disk/by-partlabel/", "disk/by-path/", "/", NULL }; ++ ++ for (const char **cursor = middles; *cursor != NULL; cursor++) { ++ char *proposed = xasprintf ("/dev/%s/%s", *cursor, name); ++ struct stat stt; ++ /* Peek at what exists to know what to say the device is. */ ++ if (lstat (proposed, &stt) == 0) { ++ devices[ndevices++] = proposed; ++ break; ++ } else { ++ free(proposed); ++ } ++ } ++ } ++ } + break; + } + diff -Nru grub2-2.02~beta2/debian/patches/series grub2-2.02~beta2/debian/patches/series --- grub2-2.02~beta2/debian/patches/series 2015-12-03 15:22:41.000000000 -0500 +++ grub2-2.02~beta2/debian/patches/series 2015-12-18 17:07:31.000000000 -0500 @@ -86,3 +86,4 @@ efidisk-device-path-helpers-for-efinet.patch efinet-skip-virtual-devices-on-enumeration.patch efinet-enable-hardware-filters-on-interface.patch +grubprobe-zfspool-device-name-prepend