Bug#260276: grubconf: parses "root=" in menu.lst incorrectly

Joseph Monti Joseph Monti <monti@smartrobots.com>, 260276@bugs.debian.org
Mon, 19 Jul 2004 20:49:22 -0400


Hi,

Thanks for the email. (Sorry I haven't been keeping up with your
patches).

That patch for the root= problem, would probably be better done with:

========================================================
for (i = 0; tmp != NULL && i < dev_size; i++, tmp = tmp->next) {
	if (strcmp(dev_str, tmp->dev_name) == 0) {
		return i;
	}
}
return -1;
========================================================

I don't have time now to test it and get a patch together, but it should
be more versatile than the previous implementation.

The original assumed that there were fewer than 10 partitions/disk. And
I opted to try and optimize the comparison under that assumption. I
think it would just be better to use strcmp.

I'll try to find some time this week to review your patches and roll
them into the next release. 

Thanks!
 - Joe


On Mon, 2004-07-19 at 20:22, Luis R. Rodriguez wrote:
> package grubconf
> tags 260276 patch
> tags 260276 upstream
> thanks
> 
> Mika,
> 
> this is a bug that should be reported to upstream. I've added
> Joseph Monti to the e-mail thread (he's the upstream author). Bellow is my attempt
> to fix it though. Try this deb and let me know if that fixed it:
> 
> http://ruslug.rutgers.edu/~mcgrof/grubconf/grubconf-0.5.1-debian/grubconf_0.5.1-4_i386.deb
> 
> Monti, can you provide insight or look into this when you get a chance?
> There are other patches I've added to the debian package myself. They
> can be viewed at:
> 
> http://ruslug.rutgers.edu/~mcgrof/grubconf/patches/
> 
> Here is the patch I applied:
> 
> --- grubconf-0.5.1/src/grubconf_dev.c.orig	2004-07-19 19:45:01.000000000 -0400
> +++ grubconf-0.5.1/src/grubconf_dev.c	2004-07-19 19:45:39.000000000 -0400
> @@ -313,7 +313,8 @@
>  	for (i = 0; tmp != NULL && i < dev_size; i++, tmp = tmp->next) {
>  		if ( *(tmp->dev_name + 5) == *(dev_str + 5) &&
>  				*(tmp->dev_name + 7) == *(dev_str + 7) && 
> -				*(tmp->dev_name + 8) == *(dev_str + 8) ) {
> +				*(tmp->dev_name + 8) == *(dev_str + 8) &&
> +				*(tmp->dev_name + 9) == *(dev_str + 9)) {
>  			return i;
>  		}
>  	}
> 
> On Mon, Jul 19, 2004 at 09:12:08PM +0300, Mika Wahlroos wrote:
> > Package: grubconf
> > Version: 0.5.1-3
> > Severity: normal
> > 
> > When grubconf is started and reads the grub configuration file, root=/dev/hda1x in the 
> > options of the kernel becomes root=/dev/hda1 - it drops the latter numeral. For example in 
> > my menu.lst (which was originally generated by grubconf)
> > 
> > title Debian GNU/Linux
> > #:0 <-- type: 0 => linux, 1 => windows, 2 => other
> >         root (hd0,7)
> >         kernel /bzImage root=/dev/hda10 (null)
> > 
> > becomes
> > 
> > title Debian GNU/Linux
> > #:0 <-- type: 0 => linux, 1 => windows, 2 => other
> >         root (hd0,7)
> >         kernel /bzImage root=/dev/hda1 (null)
> > 
> > The same happens to another entry where root=/dev/hda12 - it also becomes
> > /dev/hda1.
> > 
> > The change appears in the grubconf GUI immediately following grubconf startup and sticks 
> > in the configuration file if grubconf rewrites it, i.e. if something is modified with 
> > grubconf.
> > 
> > -- System Information:
> > Debian Release: testing/unstable
> >   APT prefers unstable
> >   APT policy: (500, 'unstable')
> > Architecture: i386 (i686)
> > Kernel: Linux 2.6.7
> > Locale: LANG=fi_FI, LC_CTYPE=fi_FI
> > 
> > Versions of packages grubconf depends on:
> > ii  grub                  0.95+cvs20040624-4 GRand Unified Bootloader
> > ii  libart-2.0-2          2.3.16-5           Library of functions for 2D graphi
> > ii  libatk1.0-0           1.6.1-2            The ATK accessibility toolkit
> > ii  libaudiofile0         0.2.6-4            Open-source version of SGI's audio
> > ii  libbonobo2-0          2.6.2-4            Bonobo CORBA interfaces library
> > ii  libbonoboui2-0        2.6.1-1            The Bonobo UI library
> > ii  libc6                 2.3.2.ds1-13       GNU C Library: Shared libraries an
> > ii  libesd0               0.2.29-1           Enlightened Sound Daemon - Shared 
> > ii  libgconf2-4           2.6.2-1            GNOME configuration database syste
> > ii  libgcrypt7            1.1.90-9           LGPL Crypto library - runtime libr
> > ii  libglib2.0-0          2.4.4-1            The GLib library of C routines
> > ii  libgnome-keyring0     0.2.1-2            GNOME keyring services library
> > ii  libgnome2-0           2.6.1-8            The GNOME 2 library - runtime file
> > ii  libgnomecanvas2-0     2.6.1.1-2          A powerful object-oriented display
> > ii  libgnomeui-0          2.6.1.1-3          The GNOME 2 libraries (User Interf
> > ii  libgnomevfs2-0        2.6.1.1-5          The GNOME virtual file-system libr
> > ii  libgnutls10           1.0.4-3            GNU TLS library - runtime library
> > ii  libgpg-error0         0.7-3              library for common error values an
> > ii  libgtk2.0-0           2.4.3-3            The GTK+ graphical user interface 
> > ii  libice6               4.3.0.dfsg.1-6     Inter-Client Exchange library
> > ii  libjpeg62             6b-9               The Independent JPEG Group's JPEG 
> > ii  liborbit2             1:2.10.2-1.1       libraries for ORBit2 - a CORBA ORB
> > ii  libpango1.0-0         1.4.0-4            Layout and rendering of internatio
> > ii  libpopt0              1.7-4              lib for parsing cmdline parameters
> > ii  libsm6                4.3.0.dfsg.1-6     X Window System Session Management
> > ii  libtasn1-2            0.2.7.0-2          Manage ASN.1 structures (runtime)
> > ii  libx11-6              4.3.0.dfsg.1-6     X Window System protocol client li
> > ii  libxml2               2.6.11-1           GNOME XML library
> > ii  xlibs                 4.3.0.dfsg.1-6     X Window System client libraries m
> > ii  zlib1g                1:1.2.1.1-5        compression library - runtime
> > 
> > -- no debconf information
> > 
> > 
> > _______________________________________________
> > Pkg-grub-devel mailing list
> > Pkg-grub-devel@lists.alioth.debian.org
> > http://lists.alioth.debian.org/mailman/listinfo/pkg-grub-devel
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ Joseph Monti                                            ]
[ monti@smartrobots.com                                   ]
[ http://www.smartrobots.com/                             ]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=