Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1O0hxx-0004ZC-Uz for mharc-grub-devel@gnu.org; Sat, 10 Apr 2010 17:11:45 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O0hxv-0004Z7-Tl for grub-devel@gnu.org; Sat, 10 Apr 2010 17:11:43 -0400 Received: from [140.186.70.92] (port=59887 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0hxt-0004Yz-Ne for grub-devel@gnu.org; Sat, 10 Apr 2010 17:11:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O0hxs-0001rz-JH for grub-devel@gnu.org; Sat, 10 Apr 2010 17:11:41 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:59580) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O0hxs-0001rm-B4 for grub-devel@gnu.org; Sat, 10 Apr 2010 17:11:40 -0400 X-Originating-IP: 217.70.178.44 Received: from mfilter3-d.gandi.net (mfilter3-d.gandi.net [217.70.178.44]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id EB712225191; Sat, 10 Apr 2010 23:11:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter3-d.gandi.net Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by mfilter3-d.gandi.net (mfilter3-d.gandi.net [217.70.178.44]) (amavisd-new, port 10024) with ESMTP id 7lBaOXKh9jae; Sat, 10 Apr 2010 23:11:25 +0200 (CEST) X-Originating-IP: 80.32.81.197 Received: from mail.pina.cat (197.Red-80-32-81.staticIP.rima-tde.net [80.32.81.197]) (Authenticated sender: pina@pina.cat) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 169B5225187; Sat, 10 Apr 2010 23:11:18 +0200 (CEST) Received: from pinux (cpc2-hari6-0-0-cust86.hari.cable.virginmedia.com [82.45.164.87]) by mail.pina.cat (Postfix) with ESMTPA id 7DC12288F3004; Sat, 10 Apr 2010 23:11:17 +0200 (CEST) Received: from pinux (localhost.localdomain [127.0.0.1]) by pinux (Postfix) with ESMTP id 61769894F9B; Sat, 10 Apr 2010 22:11:16 +0100 (BST) Received: by pinux (Postfix, from userid 1000) id 1AE8E894F9A; Sat, 10 Apr 2010 22:10:16 +0100 (BST) Date: Sat, 10 Apr 2010 22:10:15 +0100 From: Carles Pina i Estany To: grub-devel@gnu.org Message-ID: <20100410211015.GA26131@pina.cat> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="xHFwDpU9dbj6ez1V" Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: marcos@softastur.org, malditoastur@gmail.com Subject: escape strings in grub.cfg X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2010 21:11:44 -0000 --xHFwDpU9dbj6ez1V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, Last weekend, the Asturian team found a bug in Grub. Thanks for the debugging. The string that appears in grub.cfg for "Loading the initram" in Asturian is "Cargando'l discu RAM inicial...". So grub.cfg looks like: echo Cargando'l discu RAM inicial... This is syntactically invalid because the character "'". Easy work around: generate the line like: echo "Cargando'l discu RAM inicial..." New problem: in some language, this string could have a double quote inside. New solution: escape the double quotes strings when they are used in gettext and always use these strings with double quotes. See the attached patch. I'm not convinced of the patch, does anybody has a cleaner idea/patch? Cheers, PS: I haven't double checked, but lines like initrd /boot/initrd.img-2.6.32-18-generic will fail if the path has spaces. I'll address it in the future. PS2: I haven't checked the patch yet, let's comment on the idea. Before committing I would write the changelog and check it. -- Carles Pina i Estany http://pinux.info --xHFwDpU9dbj6ez1V Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="gettext_double_quotes.patch" === modified file 'util/grub-mkconfig_lib.in' --- util/grub-mkconfig_lib.in 2010-02-25 13:30:50 +0000 +++ util/grub-mkconfig_lib.in 2010-04-10 20:47:18 +0000 @@ -188,3 +188,8 @@ version_find_latest () done echo "$a" } + +gettext_escape_double_quotes () +{ + echo -n $(gettext $@) | sed 's/\"/\\\"/' +} === modified file 'util/grub.d/10_linux.in' --- util/grub.d/10_linux.in 2010-04-08 09:54:44 +0000 +++ util/grub.d/10_linux.in 2010-04-10 20:49:06 +0000 @@ -56,9 +56,9 @@ linux_entry () recovery="$3" args="$4" if ${recovery} ; then - title="$(gettext "%s, with Linux %s (recovery mode)")" + title="$(gettext_escape_double_quotes "%s, with Linux %s (recovery mode)")" else - title="$(gettext "%s, with Linux %s")" + title="$(gettext_escape_double_quotes "%s, with Linux %s")" fi printf "menuentry \"${title}\" ${CLASS} {\n" "${os}" "${version}" save_default_entry | sed -e "s/^/\t/" @@ -83,12 +83,12 @@ EOF fi printf '%s\n' "${prepare_boot_cache}" cat << EOF - echo $(printf "$(gettext "Loading Linux %s ...")" ${version}) + echo \"$(printf "$(gettext_escape_double_quotes "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_escape_double_quotes "Loading initial ramdisk ...")\" initrd ${rel_dirname}/${initrd} EOF fi --xHFwDpU9dbj6ez1V--