From ce44826e79a92aaf21e19580d0580d29121d2260 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Tue, 13 Apr 2010 13:57:56 +0100 Subject: [PATCH] Enclose all translated strings in grub.cfg in single quotes, and escape them appropriately (Ubuntu bug #552921). * util/grub-mkconfig_lib.in (gettext_quoted): New function. * util/grub.d/10_hurd.in: Use it. * util/grub.d/10_kfreebsd.in (kfreebsd_entry): Likewise. * util/grub.d/10_linux.in (linux_entry): Likewise. Also-By: Colin Watson --- ChangeLog | 11 +++++++++++ util/grub-mkconfig_lib.in | 4 ++++ util/grub.d/10_hurd.in | 8 ++++---- util/grub.d/10_kfreebsd.in | 6 +++--- util/grub.d/10_linux.in | 10 +++++----- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index d766bcd50..4be24c1b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2010-04-13 Carles Pina i Estany +2010-04-13 Colin Watson + + Enclose all translated strings in grub.cfg in single quotes, and + escape them appropriately (Ubuntu bug #552921). + + * util/grub-mkconfig_lib.in (gettext_quoted): New function. + * util/grub.d/10_hurd.in: Use it. + * util/grub.d/10_kfreebsd.in (kfreebsd_entry): Likewise. + * util/grub.d/10_linux.in (linux_entry): Likewise. + 2010-04-11 Vladimir Serbinenko Fix cygwin compilation. diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in index bcd6baffb..a4151348c 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -188,3 +188,7 @@ version_find_latest () done echo "$a" } + +gettext_quoted () { + gettext "$@" | sed "s/'/'\\\\''/g" +} diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in index 5dbb11f22..8e16e7d9f 100644 --- a/util/grub.d/10_hurd.in +++ b/util/grub.d/10_hurd.in @@ -76,13 +76,13 @@ menuentry "${OS}" ${CLASS} { EOF prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/" cat << EOF - echo $(gettext "Loading GNU Mach ...") + echo '$(gettext_quoted "Loading GNU Mach ...")' multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} EOF save_default_entry | sed -e "s/^/\t/" prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/" cat << EOF - echo $(gettext "Loading the Hurd ...") + echo '$(gettext_quoted "Loading the Hurd ...")' module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\ --multiboot-command-line='\${kernel-command-line}' \\ --host-priv-port='\${host-port}' \\ @@ -98,13 +98,13 @@ menuentry "${OS} (recovery mode)" { EOF prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/" cat << EOF - echo $(gettext "Loading GNU Mach ...") + echo '$(gettext_quoted "Loading GNU Mach ...")' multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} -s EOF save_default_entry | sed -e "s/^/\t/" prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/" cat << EOF - echo $(gettext "Loading the Hurd ...") + echo '$(gettext_quoted "Loading the Hurd ...")' module /hurd/${hurd_fs}.static ${hurd_fs} \\ --multiboot-command-line='\${kernel-command-line}' \\ --host-priv-port='\${host-port}' \\ diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in index 43651c82b..5ab546282 100644 --- a/util/grub.d/10_kfreebsd.in +++ b/util/grub.d/10_kfreebsd.in @@ -44,15 +44,15 @@ kfreebsd_entry () version="$2" recovery="$3" # not used yet args="$4" # not used yet - title="$(gettext "%s, with kFreeBSD %s")" - printf "menuentry \"${title}\" ${CLASS} {\n" "${os}" "${version}" + title="$(gettext_quoted "%s, with kFreeBSD %s")" + printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}" save_default_entry | sed -e "s/^/\t/" if [ -z "${prepare_boot_cache}" ]; then prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" fi printf '%s\n' "${prepare_boot_cache}" cat << EOF - echo $(printf "$(gettext "Loading kernel of FreeBSD %s ...")" ${version}) + echo '$(printf "$(gettext_quoted "Loading kernel of FreeBSD %s ...")" ${version})' kfreebsd ${rel_dirname}/${basename} EOF diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index 8dc0df5d9..e691cae86 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -56,11 +56,11 @@ linux_entry () recovery="$3" args="$4" if ${recovery} ; then - title="$(gettext "%s, with Linux %s (recovery mode)")" + title="$(gettext_quoted "%s, with Linux %s (recovery mode)")" else - title="$(gettext "%s, with Linux %s")" + title="$(gettext_quoted "%s, with Linux %s")" fi - printf "menuentry \"${title}\" ${CLASS} {\n" "${os}" "${version}" + printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}" save_default_entry | sed -e "s/^/\t/" # Use ELILO's generic "efifb" when it's known to be available. @@ -83,12 +83,12 @@ EOF fi printf '%s\n' "${prepare_boot_cache}" cat << EOF - echo $(printf "$(gettext "Loading Linux %s ...")" ${version}) + echo '$(printf "$(gettext_quoted "Loading Linux %s ...")" ${version})' linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} EOF if test -n "${initrd}" ; then cat << EOF - echo $(gettext "Loading initial ramdisk ...") + echo '$(gettext_quoted "Loading initial ramdisk ...")' initrd ${rel_dirname}/${initrd} EOF fi