Bug#266049: update-grub handles four-digit kernel versions wrongly

Tavernarakis Costas Tavernarakis Costas <taver@otenet.gr>, 266049@bugs.debian.org
Mon, 16 Aug 2004 17:06:36 +0300


Package: grub
Version: 0.95+cvs20040624-7
Severity: important
Tags: patch

update_grub mishandles 2.6.8.1, in the kopt_version part of the config.

The sed expression on line 507 in update_grub is ambigious with regard to
4-digit kernel version numbers. It will pick 6.8.1 as kernel version out
of 2.6.8.1. It COULD have picked 2.6.8 (which would have made a lot more
sense), however this implementation of sed (sed 4.1.1-1) favors
expanding the latter '*' rather than the initial.

As a result, update_grub IGNORES any kopt_2_6 entries in
/boot/grub/menu.lst and proceeds with the defaults.

One simple solution is to re-write the sed regexp in order not to match
any numbers before the version number.

** /ug.old Mon Aug 16 16:32:56 2004
--- /sbin/update-grub   Mon Aug 16 16:33:33 2004
***************
*** 483,489 ****
  {
        kernel_version=$1

!       version=$(echo $kernel_version | sed
's/.*\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*/\1_\2_\3/')
        if [ -n "$version" ] ; then
                while [ -n "$version" ] ; do
                        currentOpt="$(eval "echo \$kopt_$version")"
--- 483,489 ----
  {
        kernel_version=$1

!       version=$(echo $kernel_version | sed
's/[^0-9]*\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*/\1_\2_\3/')
        if [ -n "$version" ] ; then
                while [ -n "$version" ] ; do
                        currentOpt="$(eval "echo \$kopt_$version")"


-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.7
Locale: LANG=C, LC_CTYPE=el_GR

Versions of packages grub depends on:
ii  libc6                       2.3.2.ds1-13 GNU C Library: Shared libraries an
ii  libncurses5                 5.4-4        Shared libraries for terminal hand

-- no debconf information