pyGrub: Fix default when out of range
PATCH 1/1 pyGrub: Fix default when out of range
Hi,
this is the patch to fix pyGrub default value when it's being set out of range. This patch makes the quiet and interactive mode select the same default image when the default value for boot entry is out of range, i.e. when the guest is having wrong configuration in it's boot loader (like 3 entries with default mistakenly set to 10 etc).
When the boot entry number is being set out of range it falls back to 0 (first entry of boot loader).
Michal
Signature · 2 lines
Michal Novotny<[email protected]>, RHCE Virtualization Team (xen userspace), Red Hat
tools/pygrub/src/pygrub +3 -0
@@ -415,6 +415,9 @@ class Grub: timeout = int(self.cf.timeout) self.selected_image = self.cf.default + # If the selected (default) image doesn't exist we select the first entry + if self.selected_image > len(self.cf.images): + self.selected_image = 0 self.isdone = False while not self.isdone: self.run_main(timeout)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Michal Novotny writes ("[Xen-devel] [PATCH] pyGrub: Fix default when out of range"):
Quoted 5 lines
this is the patch to fix pyGrub default value when it's being set out of range. This patch makes the quiet and interactive mode select the same default image when the default value for boot entry is out of range, i.e. when the guest is having wrong configuration in it's boot loader (like 3 entries with default mistakenly set to 10 etc).
I'm not sure this is right. What does grub proper do with invalid defaults ? Is it really correct to blunder on and just use the first one as a default ?
Sorry to quibble.
Ian.
Quoted 8 lines · Ian Jackson
Michal Novotny writes ("[Xen-devel] [PATCH] pyGrub: Fix default when out of range"):
Quoted 6 lines
this is the patch to fix pyGrub default value when it's being set out of range. This patch makes the quiet and interactive mode select the same default image when the default value for boot entry is out of range, i.e. when the guest is having wrong configuration in it's boot loader (like 3 entries with default mistakenly set to 10 etc).
Quoted 8 lines
I'm not sure this is right. What does grub proper do with invalid defaults ? Is it really correct to blunder on and just use the first one as a default ?
Sorry to quibble.
Ian.
Hi Ian,
I did try it using the real (bare-metal) grub 0.97 (in RHEL-5) to set the default out of range and it was set to the first entry so it matches the bare-metal grub behavior now. So the quiet mode was having it right all the time but interactive mode didn't so this is basically fix for interactive mode of pygrub.
Michal
Signature · 2 lines
Michal Novotny<[email protected]>, RHCE Virtualization Team (xen userspace), Red Hat
Michal Novotny writes ("Re: [Xen-devel] [PATCH] pyGrub: Fix default when out of range"):
Quoted 5 lines
I did try it using the real (bare-metal) grub 0.97 (in RHEL-5) to set the default out of range and it was set to the first entry so it matches the bare-metal grub behavior now. So the quiet mode was having it right all the time but interactive mode didn't so this is basically fix for interactive mode of pygrub.
Excellent, thanks for the clarification. I have applied your patch.
Ian.