From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Wilson Subject: Re: [PATCH] Fix pygrub handling non-default entry Date: Thu, 10 Jan 2013 09:36:30 +0100 Message-ID: <20130110083617.GA6316@u109add4315675089e695.ant.amazon.com> References: <20130109132929.GA26888@lws.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20130109132929.GA26888@lws.brq.redhat.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: Miroslav Rezanina Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, Jan 09, 2013 at 02:29:29PM +0100, Miroslav Rezanina wrote: > 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. > > Signed-off-by: Miroslav Rezanina Acked-by: Matt Wilson > Patch: > --- > diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub > index 1845485..eedfdb2 100644 > --- a/tools/pygrub/src/pygrub > +++ b/tools/pygrub/src/pygrub > @@ -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: