Package: release.debian.org Severity: normal User: release.debian....@packages.debian.org Usertags: unblock
I think we should include this os-prober upload in wheezy; it fixes a messy grub.cfg parsing bug (see https://bugs.launchpad.net/bugs/1050774) in the event that another operating system has GRUB 2.00 installed. This version of GRUB will be used by jessie and Ubuntu >= 12.10. The sed expressions are insane. Sorry about that. I've tested them as best I can based on what grub-mkconfig generates in practice ... diff -Nru os-prober-1.55/debian/changelog os-prober-1.56/debian/changelog --- os-prober-1.55/debian/changelog 2012-08-25 08:58:51.000000000 +0100 +++ os-prober-1.56/debian/changelog 2012-09-17 19:02:31.000000000 +0100 @@ -1,3 +1,16 @@ +os-prober (1.56) unstable; urgency=low + + [ Hedayat Vatankhah ] + * Add support for probing Fedora's location for the GRUB 2 configuration + file (closes: #674560). + + [ Colin Watson ] + * Fix the parsing code in the grub2 handler so that it no longer gets + hopelessly confused by multiple single-quoted strings on the same line, + as produced by GRUB 2.00. + + -- Colin Watson <cjwat...@debian.org> Mon, 17 Sep 2012 19:02:29 +0100 + os-prober (1.55) unstable; urgency=low * Improve detection of Haiku: detect the 64-bit version diff -Nru os-prober-1.55/linux-boot-probes/mounted/common/40grub2 os-prober-1.56/linux-boot-probes/mounted/common/40grub2 --- os-prober-1.55/linux-boot-probes/mounted/common/40grub2 2011-05-02 02:00:46.000000000 +0100 +++ os-prober-1.56/linux-boot-probes/mounted/common/40grub2 2012-09-17 18:32:52.000000000 +0100 @@ -44,13 +44,17 @@ entry_result shift 1 # The double-quoted string is the title. - title="$(echo "$@" | sed -n 's/[^"]*"\(.*\)".*/\1/p' | sed 's/://g')" + # Make sure to look at the text of the line + # before 'set' mangled it. + title="$(echo "$line" | sed -n 's/[^"]*"\(.*\)".*/\1/p' | sed 's/://g')" if [ -z "$title" ]; then - # ... or single-quoted? The - # unescaping here is odd because the - # 'set' above has already eaten - # backslash-escapes. - title="$(echo "$@" | sed -n "s/[^']*'\(.*\)'.*/\1/p" | sed "s/'''/'/; s/://g")" + # ... or single-quoted? Be careful + # to handle constructions like + # 'foo'\''bar' (which expands to + # foo'bar, as in shell), and to + # handle multiple single-quoted + # strings on the same line. + title="$(echo "$line" | sed -n "s/[^']*'\(\([^']\|'\\\\''\)*\)'.*/\1/p" | sed "s/'\\\\''/'/; s/://g")" fi if [ -z "$title" ]; then ignore_item=1 @@ -94,6 +98,9 @@ [ "$mpoint/boot/grub/grub.cfg" -nt "$mpoint/boot/grub/menu.lst" ]); then debug "parsing grub.cfg" parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/grub.cfg" +elif [ -e "$mpoint/boot/grub2/grub.cfg" ]; then + debug "parsing grub.cfg" + parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub2/grub.cfg" fi if [ "$found_item" = 0 ]; then Thanks, -- Colin Watson [cjwat...@debian.org] -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org