[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] pygrub: fix non-interactive parsing of grub1 config files



On 09/08/2014 10:01 AM, David Scott wrote:
From: David Scott <dave.scott@xxxxxxxxxxxxx>

Since c/s d1b93ea2, the type of 'sel' now depends on whether pygrub
is run interactively or not. In non-interactive / quiet mode it is
a string; in interactive mode it is an integer.

When 'sel' is used to index an array it must be used as an integer.

Signed-off-by: David Scott <dave.scott@xxxxxxxxxx>
---
  tools/pygrub/src/pygrub |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
index 2618e11..f167a51 100644
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -630,7 +630,7 @@ def run_grub(file, entry, fs, cfg_args):
          sys.exit(1)
try:
-        img = g.cf.images[sel]
+        img = g.cf.images[int(sel)]

What if sel is a "true" string (i.e. a name of the kernel to boot as opposed to an index)? Should we do the same thing as what Grub:run() does to map value to index?

-boris


      except IndexError:
          img = g.cf.images[0]


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.