* [PATCH v2] configure: silence 'shift' error message in version_ge()
@ 2020-08-21 16:33 Stefano Garzarella
2020-08-21 16:44 ` Philippe Mathieu-Daudé
2020-08-21 18:18 ` Eric Blake
0 siblings, 2 replies; 4+ messages in thread
From: Stefano Garzarella @ 2020-08-21 16:33 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Philippe Mathieu-Daudé,
Marc-André Lureau, Peter Maydell
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
local_ver1=$*
set x $local_ver2
# the second argument finished, the first must be greater or equal
--
2.26.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] configure: silence 'shift' error message in version_ge()
2020-08-21 16:33 [PATCH v2] configure: silence 'shift' error message in version_ge() Stefano Garzarella
@ 2020-08-21 16:44 ` Philippe Mathieu-Daudé
2020-08-21 18:18 ` Eric Blake
1 sibling, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-08-21 16:44 UTC (permalink / raw)
To: Stefano Garzarella, qemu-devel
Cc: Paolo Bonzini, Marc-André Lureau, Peter Maydell
On 8/21/20 6:33 PM, 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
> local_ver1=$*
> set x $local_ver2
> # the second argument finished, the first must be greater or equal
>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] configure: silence 'shift' error message in version_ge()
2020-08-21 16:33 [PATCH v2] configure: silence 'shift' error message in version_ge() Stefano Garzarella
2020-08-21 16:44 ` Philippe Mathieu-Daudé
@ 2020-08-21 18:18 ` Eric Blake
2020-08-21 20:21 ` Stefano Garzarella
1 sibling, 1 reply; 4+ messages in thread
From: Eric Blake @ 2020-08-21 18:18 UTC (permalink / raw)
To: Stefano Garzarella, qemu-devel
Cc: Peter Maydell, Paolo Bonzini, Philippe Mathieu-Daudé,
Marc-André Lureau
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}
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] configure: silence 'shift' error message in version_ge()
2020-08-21 18:18 ` Eric Blake
@ 2020-08-21 20:21 ` Stefano Garzarella
0 siblings, 0 replies; 4+ messages in thread
From: Stefano Garzarella @ 2020-08-21 20:21 UTC (permalink / raw)
To: Eric Blake
Cc: Peter Maydell, Paolo Bonzini, Philippe Mathieu-Daudé,
qemu-devel, Marc-André Lureau
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-21 20:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-21 16:33 [PATCH v2] configure: silence 'shift' error message in version_ge() Stefano Garzarella
2020-08-21 16:44 ` Philippe Mathieu-Daudé
2020-08-21 18:18 ` Eric Blake
2020-08-21 20:21 ` Stefano Garzarella
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.