qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2] configure: silence 'shift' error message in version_ge()


From: Stefano Garzarella
Subject: Re: [PATCH v2] configure: silence 'shift' error message in version_ge()
Date: Fri, 21 Aug 2020 22:21:32 +0200

On Fri, Aug 21, 2020 at 01:18:54PM -0500, Eric Blake wrote:
> On 8/21/20 11:33 AM, Stefano Garzarella wrote:
> > If there are less than 2 arguments in version_ge(), the second
> > 'shift' prints this error:
> >      ../configure: line 232: shift: shift count out of range
> > 
> > Let's skip it if there are no more arguments.
> > 
> > Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
> > ---
> > v2:
> > - do not shift if there are no more arguments [Peter]
> > ---
> >   configure | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/configure b/configure
> > index 4e5fe33211..5f5f370e2c 100755
> > --- a/configure
> > +++ b/configure
> > @@ -229,7 +229,7 @@ version_ge () {
> >           set x $local_ver1
> >           local_first=${2-0}
> >           # shift 2 does nothing if there are less than 2 arguments
> > -        shift; shift
> > +        shift; test $# -gt 0 && shift
> 
> 
> That works.  Or you could go with the shorter one-liner:
> 
> shift ${2:+2}

yeah, it is better!

I'll send v3.

Thanks,
Stefano




reply via email to

[Prev in Thread] Current Thread [Next in Thread]