Skip to contentSkip to conversation

Fix pygrub handling non-default entry

PATCH In review Miroslav Rezanina 3 participants 3 messages Jan 9, 2013 – Jan 17, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix pygrub handling non-default entry

If we pass 0 as pygrub --entry argument (i.e. we want to boot first item), default value is used instead. This is dueto wrong check for range of allowed values of index - 0 is index of first item.

Patch:
---

tools/pygrub/src/pygrub +1 -1
index 1845485..eedfdb2 100644
@@ -613,7 +613,7 @@ def run_grub(file, entry, fs, cfg_args):
     # set the entry to boot as requested
     if entry is not None:
         idx = get_entry_idx(g.cf, entry)
-        if idx is not None and idx > 0 and idx < len(g.cf.images):
+        if idx is not None and idx >= 0 and idx < len(g.cf.images):
            sel = idx
 
     if sel == -1:
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Miroslav Rezanina

If we pass 0 as pygrub --entry argument (i.e. we want to boot first item), default value is used instead. This is dueto wrong check for range of allowed values of index - 0 is index of first item.

Quoted 15 lines

Patch:
---

tools/pygrub/src/pygrub +1 -1
index 1845485..eedfdb2 100644
@@ -613,7 +613,7 @@ def run_grub(file, entry, fs, cfg_args):
     # set the entry to boot as requested
     if entry is not None:
         idx = get_entry_idx(g.cf, entry)
-        if idx is not None and idx > 0 and idx < len(g.cf.images):
+        if idx is not None and idx >= 0 and idx < len(g.cf.images):
            sel = idx
 
     if sel == -1: