Commit 717daf06 authored by Colin Watson's avatar Colin Watson

Fix the parsing code in the grub2 handler so that it no longer gets hopelessly...

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.
parent a9a742c6
......@@ -4,6 +4,11 @@ os-prober (1.56) UNRELEASED; urgency=low
* 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 <cjwatson@debian.org> Mon, 17 Sep 2012 16:15:56 +0100
os-prober (1.55) unstable; urgency=low
......
......@@ -44,13 +44,17 @@ parse_grub_menu () {
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment