Fri 13 Jul 2012 10:15:50 AM UTC, original submission:
Using the grub2-mkconfig of the latest release grub-2.00 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 of grub.cfg:
### 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 ###
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.
|