Avoid getting confused by inaccessible loop device backing paths

(LP: #938724).
This commit is contained in:
Colin Watson 2012-09-26 16:03:05 +01:00
parent dc50034e02
commit f84028752c
5 changed files with 55 additions and 5 deletions

2
debian/changelog vendored
View File

@ -6,6 +6,8 @@ grub2 (2.00-7) UNRELEASED; urgency=low
* Merge from Ubuntu: * Merge from Ubuntu:
- Prefer translations from language packs (LP: #537998). (No-op for - Prefer translations from language packs (LP: #537998). (No-op for
Debian, but harmless.) Debian, but harmless.)
- Avoid getting confused by inaccessible loop device backing paths
(LP: #938724).
-- Colin Watson <cjwatson@debian.org> Wed, 26 Sep 2012 13:16:52 +0100 -- Colin Watson <cjwatson@debian.org> Wed, 26 Sep 2012 13:16:52 +0100

View File

@ -0,0 +1,46 @@
Description: Avoid getting confused by inaccessible loop device backing paths
Author: Colin Watson <cjwatson@ubuntu.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/938724
Forwarded: no
Last-Update: 2012-09-07
Index: b/util/grub-mkconfig_lib.in
===================================================================
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -138,7 +138,7 @@
/dev/*) ;;
*)
loop_device="${device}"
- device=`"${grub_probe}" --target=device "${loop_file}"`
+ device=`"${grub_probe}" --target=device "${loop_file}"` || return 0
;;
esac
;;
Index: b/util/grub.d/30_os-prober.in
===================================================================
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -169,6 +169,11 @@
LINITRD="${LINITRD#/boot}"
fi
+ if [ -z "${prepare_boot_cache}" ]; then
+ prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")"
+ [ "${prepare_boot_cache}" ] || continue
+ fi
+
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
recovery_params="$(echo "${LPARAMS}" | grep 'single\|recovery')" || true
counter=1
@@ -180,10 +185,6 @@
fi
used_osprober_linux_ids="$used_osprober_linux_ids 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id'"
- if [ -z "${prepare_boot_cache}" ]; then
- prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")"
- fi
-
if [ "x$is_first_entry" = xtrue ]; then
cat << EOF
menuentry '$(echo "$OS" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' {

View File

@ -26,3 +26,4 @@ emu_freebsd.patch
mkconfig_stderr_handling.patch mkconfig_stderr_handling.patch
tftp_endianness.patch tftp_endianness.patch
install_locale_langpack.patch install_locale_langpack.patch
mkconfig_nonexistent_loopback.patch

View File

@ -138,7 +138,7 @@ prepare_grub_to_access_device ()
/dev/*) ;; /dev/*) ;;
*) *)
loop_device="${device}" loop_device="${device}"
device=`"${grub_probe}" --target=device "${loop_file}"` device=`"${grub_probe}" --target=device "${loop_file}"` || return 0
;; ;;
esac esac
;; ;;

View File

@ -169,6 +169,11 @@ EOF
LINITRD="${LINITRD#/boot}" LINITRD="${LINITRD#/boot}"
fi fi
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")"
[ "${prepare_boot_cache}" ] || continue
fi
onstr="$(gettext_printf "(on %s)" "${DEVICE}")" onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
recovery_params="$(echo "${LPARAMS}" | grep 'single\|recovery')" || true recovery_params="$(echo "${LPARAMS}" | grep 'single\|recovery')" || true
counter=1 counter=1
@ -180,10 +185,6 @@ EOF
fi fi
used_osprober_linux_ids="$used_osprober_linux_ids 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id'" used_osprober_linux_ids="$used_osprober_linux_ids 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id'"
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")"
fi
if [ "x$is_first_entry" = xtrue ]; then if [ "x$is_first_entry" = xtrue ]; then
cat << EOF cat << EOF
menuentry '$(echo "$OS" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' { menuentry '$(echo "$OS" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' {