From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH] pygrub: fix non-interactive parsing of grub1 config files Date: Mon, 08 Sep 2014 13:11:49 -0400 Message-ID: <540DE355.2070309@oracle.com> References: <1410184885-27359-1-git-send-email-dave.scott@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XR2TM-00072t-Vd for xen-devel@lists.xenproject.org; Mon, 08 Sep 2014 17:11:25 +0000 In-Reply-To: <1410184885-27359-1-git-send-email-dave.scott@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Scott , xen-devel@lists.xenproject.org Cc: David Scott , ian.jackson@eu.citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On 09/08/2014 10:01 AM, David Scott wrote: > From: David Scott > > 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 > --- > 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] >