From: Konrad Rzeszutek Wilk Subject: Re: [PATCH] pygrub: fix non-interactive parsing of grub1 config files Date: Fri, 24 Oct 2014 17:15:26 -0400 Message-ID: <20141024211526.GA23155@andromeda.dapyr.net> References: <1410184885-27359-1-git-send-email-dave.scott@citrix.com> <540DE355.2070309@oracle.com> <7DA4B952-036B-4638-A411-93F269320402@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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 1XhmRh-0006Yz-LQ for xen-devel@lists.xenproject.org; Fri, 24 Oct 2014 21:30:53 +0000 Content-Disposition: inline In-Reply-To: <7DA4B952-036B-4638-A411-93F269320402@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: Dave Scott Cc: Ian Campbell , Stefano Stabellini , "xen-devel@lists.xenproject.org" , Ian Jackson , Simon Rowe , Boris Ostrovsky List-Id: xen-devel@lists.xenproject.org On Wed, Sep 10, 2014 at 12:50:29PM +0000, Dave Scott wrote: > > On 8 Sep 2014, at 18:11, Boris Ostrovsky wrote: > > > 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? > > Redefining ?sel? from an index into an array into to a key of a dictionary sounds plausible to me? but I?m not really familiar enough with pygrub to offer a trustworthy opinion. > > I?ve cc:d Simon Rowe who is more familiar with pygrub ? he may have some useful thoughts. > ping ? > Dave > > > > -boris > > > > > >> except IndexError: > >> img = g.cf.images[0] > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel