SHA256
1
0
forked from pool/grub2
grub2/grub2-quote-messages-in-grub.cfg.patch

123 lines
4.4 KiB
Diff
Raw Normal View History

From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Mon Nov 19 16:40:25 UTC 2012
Subject: properly quote translated strings in grub.cfg
References: bnc#790195
Patch-Mainline: no
Not all translated strings in grub.cfg were properly quoted. This
resulted in parser errors for languages that contained literal single
quote in translations.
Upstream commit 4558
Index: grub-2.00/util/grub.d/10_hurd.in
===================================================================
--- grub-2.00.orig/util/grub.d/10_hurd.in
+++ grub-2.00/util/grub.d/10_hurd.in
@@ -117,7 +117,7 @@ EOF
opts=
fi
sed "s/^/$submenu_indentation/" << EOF
- echo '$message'
+ echo '$(echo "$message" | grub_quote)'
multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} $opts ${GRUB_CMDLINE_GNUMACH}
EOF
@@ -133,7 +133,7 @@ EOF
fi
sed "s/^/$submenu_indentation/" << EOF
- echo '$message'
+ echo '$(echo "$message" | grub_quote)'
module /hurd/${hurd_fs}.static ${hurd_fs} $opts \\
--multiboot-command-line='\${kernel-command-line}' \\
--host-priv-port='\${host-port}' \\
Index: grub-2.00/util/grub.d/10_kfreebsd.in
===================================================================
--- grub-2.00.orig/util/grub.d/10_kfreebsd.in
+++ grub-2.00/util/grub.d/10_kfreebsd.in
@@ -100,7 +100,7 @@ kfreebsd_entry ()
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
message="$(gettext_printf "Loading kernel of FreeBSD %s ..." ${version})"
sed "s/^/$submenu_indentation/" << EOF
- echo '$message'
+ echo '$(echo "$message" | grub_quote)'
kfreebsd ${rel_dirname}/${basename} ${args}
EOF
Index: grub-2.00/util/grub.d/10_linux.in
===================================================================
--- grub-2.00.orig/util/grub.d/10_linux.in
+++ grub-2.00/util/grub.d/10_linux.in
@@ -134,14 +134,14 @@ linux_entry ()
fi
message="$(gettext_printf "Loading Linux %s ..." ${version})"
sed "s/^/$submenu_indentation/" << EOF
- echo '$message'
+ echo '$(echo "$message" | grub_quote)'
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ${args}
EOF
if test -n "${initrd}" ; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
message="$(gettext_printf "Loading initial ramdisk ...")"
sed "s/^/$submenu_indentation/" << EOF
- echo '$message'
+ echo '$(echo "$message" | grub_quote)'
initrd ${rel_dirname}/${initrd}
EOF
fi
Index: grub-2.00/util/grub.d/20_linux_xen.in
===================================================================
--- grub-2.00.orig/util/grub.d/20_linux_xen.in
+++ grub-2.00/util/grub.d/20_linux_xen.in
@@ -120,16 +120,16 @@ linux_entry ()
xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})"
lmessage="$(gettext_printf "Loading Linux %s ..." ${version})"
sed "s/^/$submenu_indentation/" << EOF
- echo '$xmessage'
+ echo '$(echo "$xmessage" | grub_quote)'
multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args}
- echo '$lmessage'
+ echo '$(echo "$lmessage" | grub_quote)'
module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
message="$(gettext_printf "Loading initial ramdisk ...")"
sed "s/^/$submenu_indentation/" << EOF
- echo '$message'
+ echo '$(echo "$message" | grub_quote)'
module ${rel_dirname}/${initrd}
EOF
fi
Index: grub-2.00/util/grub-mkconfig_lib.in
===================================================================
--- grub-2.00.orig/util/grub-mkconfig_lib.in
+++ grub-2.00/util/grub-mkconfig_lib.in
@@ -260,19 +260,19 @@ version_find_latest ()
echo "$version_find_latest_a"
}
-# One layer of quotation is eaten by "", the second by sed, and the third by
-# printf; so this turns ' into \'. Note that you must use the output of
+# One layer of quotation is eaten by "" and the second by
+# sed; so this turns ' into \'. Note that you must use the output of
# this function in a printf format string.
grub_quote () {
- sed "s/'/'\\\\\\\\''/g"
+ sed "s/'/'\\\\''/g"
}
gettext_quoted () {
- gettext "$@" | sed "s/'/'\\\\\\\\''/g"
+ gettext "$@" | grub_quote
}
-# Run the first argument through gettext_quoted, and then pass that and all
+# Run the first argument through gettext, and then pass that and all
# remaining arguments to printf. This is a useful abbreviation and tends to
# be easier to type.
gettext_printf () {