bugGNU GRUB - Bugs: bug #36839, grub2-mkconfig OOM and syntax...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #36839: grub2-mkconfig OOM and syntax error depending on locale

Submitted by:  Alex <lexmingor>
Submitted on:  Fri 13 Jul 2012 10:15:50 AM UTC  
 
Category:  Configuration Severity:  Major
Priority:  5 - Normal Item Group:  Software Error
Status:  Fixed Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Closed Release: 
Release:  Bazaar - trunk Reproducibility:  Every Time
Planned Release:  None

Sun 22 Jul 2012 06:13:06 PM UTC, comment #3: 

Better fix comitted.

Vladimir Serbinenko <phcoder>
Project Administrator
Sun 22 Jul 2012 05:20:18 PM UTC, comment #2: 

This would create other problems as sometimes ' becoming \' in messages. Comment is wrong.

Vladimir Serbinenko <phcoder>
Project Administrator
Sun 22 Jul 2012 07:06:37 AM UTC, comment #1: 

The description of gettext_printf in grub-mkconfig_lib says it passes the first argument through gettext_quoted. However, the actual function does not do this.

Simple fix attached.

(file #26243)

Mike GIlbert <floppym>
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.

Alex <lexmingor>

 

Attached Files
file #26243:  grub-mkconfig_lib-gettext.patch added by floppym (380B - application/octet-stream)
file #26195:  locale_message.patch added by lexmingor (3KiB - text/x-patch - Patch to fix the quoting of some echo lines in the grub.d files)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by phcoder (Posted a comment)
  • -email is unavailable- added by floppym (Updated the item)
  • -email is unavailable- added by floppym
  • -email is unavailable- added by lexmingor (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-07-22 phcoder StatusNone => Fixed
        Open/ClosedOpen => Closed
    2012-07-22 floppym Attached File- => Added grub-mkconfig_lib-gettext.patch, #26243
    2012-07-13 floppym Carbon-Copy- => Added floppym
    2012-07-13 lexmingor Attached File- => Added locale_message.patch, #26195

    Back to the top


    Powered by Savane 3.6