Using the grub2-mkconfig with default config files but the ca_ES locale fails to generate a correct grub.cfg file. Reproducible: Always Steps to Reproduce: 1.Set ca_ES locale 2.emerge grub-2.00 3.grub2-mkconfig -o /boot/grub2/grub.cfg Actual Results: This is the output of the execution: # grub2-mkconfig -o /boot/grub2/grub.cfg Es genera grub.cfg ... S'ha trobat una imatge de linux: /boot/kernel-x86_64-3.4.4-gentoo error: s'ha acabat la memòria. error: syntax error. error: Incorrect command. error: syntax error. Hi ha un error de sintaxi a la línia 115 S'han detectat errors de sintaxi al fitxer de configuració del GRUB generat. Which translated says something like: # grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub.cfg ... Linux image found: /boot/kernel-x86_64-3.4.4-gentoo error: out of memory. error: syntax error. error: Incorrect command. error: syntax error. Syntax error on line 115 Syntax error found in the generated GRUB configuration file. Expected Results: The grub.cfg file should be generated correctly. The problem is related to some strings that in the catalan language (ca_ES) have single quotes on them, which break the quotation of the grub.cfg file once they are inserted. You can see an example on the echo message of this menuentry: ### BEGIN /etc/grub.d/10_linux ### menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-6ce2e0ff-9511-4f07-993f-a0332e024e1d' { (...) echo 'S'està carregant el Linux x86_64-3.4.4-gentoo ...' linux /kernel-x86_64-3.4.4-gentoo root=/dev/sda2 ro rootfstype=ext4 video=uvesafb:1280x800-24,mtrr:3,ywrap splash=verbose,theme:moocow console=tty1 clocksource=hpet zcache quiet pcie_aspm=force } ### END /etc/grub.d/10_linux ### I'm opening the bug here and not upstream because I believe that the fix requires just a small modification of the /etc/grub.d/10_linux file.
emerge --info: http://pastebin.com/S9Z92Hxs
> I'm opening the bug here and not upstream because I believe that the fix > requires just a small modification of the /etc/grub.d/10_linux file. It still needs to be fixed upstream, so please file a bug there. Also, if you have a solution, please share it.
Created attachment 318080 [details, diff] sys-boot/grub-2.00 patch that fixes quoting on some grub.d files The easiest solution I could think of is just to change the quoting on the echo commands from single quotes to double quotes. The offending lines are like this one from /etc/grub.d/10_linux (number 137). 135 message="$(gettext_printf "Loading Linux %s ..." ${version})" 136 sed "s/^/$submenu_indentation/" << EOF *137 echo '$message' 138 linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} I looked at the files inside util/grub.d/ in the source tarball. I found this kind of echo commands in 10_hurd.in, 10_kfreebsd.in, 10_linux.in and 20_linux_xen.in. So I wrote the attached patch to fix all this four files. I'll fill a bug upstream also.
OK, bug opened upstream at https://savannah.gnu.org/bugs/index.php?36839
+ 22 Jul 2012; Mike Gilbert <floppym@gentoo.org> + +files/grub-2.00-gettext_printf.patch, grub-2.00.ebuild, grub-9999.ebuild: + Fix problem with single quotes in translated messages in grub-mkconfig. Bug + 426364 by Alex Domingo. +