Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 426364 - sys-boot/grub-2.00 grub2-mkconfig OOM and syntax error depending on locale
Summary: sys-boot/grub-2.00 grub2-mkconfig OOM and syntax error depending on locale
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Mike Gilbert
URL: https://savannah.gnu.org/bugs/index.p...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-12 21:39 UTC by Alex Domingo
Modified: 2012-07-22 16:43 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
sys-boot/grub-2.00 patch that fixes quoting on some grub.d files (locale_message.patch,2.77 KB, patch)
2012-07-13 10:05 UTC, Alex Domingo
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Domingo 2012-07-12 21:39:17 UTC
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.
Comment 1 Alex Domingo 2012-07-12 21:41:54 UTC
emerge --info: http://pastebin.com/S9Z92Hxs
Comment 2 Mike Gilbert gentoo-dev 2012-07-13 02:13:23 UTC
> 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.
Comment 3 Alex Domingo 2012-07-13 10:05:53 UTC
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.
Comment 4 Alex Domingo 2012-07-13 10:18:31 UTC
OK, bug opened upstream at https://savannah.gnu.org/bugs/index.php?36839
Comment 5 Mike Gilbert gentoo-dev 2012-07-22 16:43:41 UTC
+  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.
+