Bug#740461: grub-common: variable overwriting in 10_linux makes adding entries unnecessarily hard

Pieter-Tjerk de Boer p.t.deboer at utwente.nl
Sat Mar 1 21:32:41 UTC 2014


Package: grub-common
Version: 1.99-27+deb7u2
Severity: wishlist

Dear Maintainer,

The code in /etc/grub.d/10_linux is a bit convoluted/confusing.
The main code at the end calls linux_entry() several times, with the second
argument coming from the variable ${version}.
Unfortunately, linux_entry() stores its 2nd argument in a variable which
is also called 'version'; to a C-programmer, it looks like it a local
variable, but actually it overwrites the global one.

As a consequence, adding a seemingly straightforward linux_entry() call
has surprising consequences:

  linux_entry "${OS}" "${version} (resume)" false \
        "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} resume=/dev/sdb2"
  linux_entry "${OS}" "${version}" false \
        "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"

One would expect this to give two options in the boot menu, one with
"(resume)" in its name and one without, but in fact both options get
this name, due to linux_entry overwriting the ${version} variable.

Fixing this is trivial by renaming the variable used inside linux_entry.


-- System Information:
Debian Release: 7.3
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages grub-common depends on:
ii  gettext-base        0.18.1.1-9
ii  libc6               2.13-38
ii  libdevmapper1.02.1  2:1.02.74-8
ii  libfreetype6        2.4.9-1.1
ii  libfuse2            2.9.0-2+deb7u1
ii  zlib1g              1:1.2.7.dfsg-13

Versions of packages grub-common recommends:
ii  os-prober  1.58

Versions of packages grub-common suggests:
ii  desktop-base   7.0.3
pn  grub-emu       <none>
pn  multiboot-doc  <none>
pn  xorriso        <none>

-- Configuration Files:
/etc/grub.d/10_linux changed [not included]

-- no debconf information



More information about the Pkg-grub-devel mailing list