Bug#395275: update-grub does not differentiate between null and non-existant options

Mike Kasick mkasick at club.cc.cmu.edu
Thu Oct 26 03:42:08 CEST 2006


Package:  grub
Version:  0.97-18
Severity: normal
Tags:     patch

Currently the update-grub script doesn't differentiate between options
that are set null in /boot/grub/menu.lst, and options that simply aren't
specified.

In the event that an option isn't specified (such as a blank
/boot/grub/menu.lst) then the default option as supplied by the
update-grub script is used (this is correct behavior).  However, if an
option is specified null, then the default option as supplied by the
update-grub script is also used--this is incorrect behavior, it should
be left null.

For example, suppose I want to boot both Xen kernels and regular kernels
with the "console=ttyS0" option, first I set "kopt=console=ttyS0".  Now,
since the xenkopt default is specified as "xenkopt=console=tty0" I must
change it to "xenkopt=" to remove the redundant console argument.
However, upon running update-grub the null xenkopt option is interpreted
as non-existant and the default "xenkopt=console=tty0" is supplied in
error.

I've attached a patch that fixes this problem by modifying the
GenMenuOpt function to see if the option already exists in the menu file
and if so uses it as-is.  Note that if the option doesn't exist, the
correct behavior is preserved.
-------------- next part --------------
diff -uNr grub-0.97.orig/debian/update-grub grub-0.97/debian/update-grub
--- grub-0.97.orig/debian/update-grub	2006-10-25 21:20:29.000000000 -0400
+++ grub-0.97/debian/update-grub	2006-10-25 21:21:47.503876542 -0400
@@ -439,9 +439,7 @@
 	opt=$1
 	value=$2
 
-	tmp=$(ExtractMenuOpt "$opt")
-
-	[ -z "$tmp" ] || value="$tmp"
+	[ -z "$(GetMenuOpts "$opt")" ] || value=$(ExtractMenuOpt "$opt")
 
 	echo $value
 }


More information about the Pkg-grub-devel mailing list