From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Stefano Garzarella <sgarzare@redhat.com>
Subject: [PULL 3/6] configure: silence 'shift' error message in version_ge()
Date: Fri, 21 Aug 2020 17:14:09 -0400 [thread overview]
Message-ID: <20200821211412.17321-4-pbonzini@redhat.com> (raw)
In-Reply-To: <20200821211412.17321-1-pbonzini@redhat.com>
From: Stefano Garzarella <sgarzare@redhat.com>
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
As Eric suggested, we can use 'shift ${2:+2}' which works out to
'shift 2' if $2 is set, or 'shift' (implicitly shift 1) if $2
is not set.
This patch replaces both 'shift; shift' occurrences in version_ge()
with 'shift ${2:+2}'.
Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200821203558.10338-1-sgarzare@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index 4e5fe33211..d9ca87fbbb 100755
--- a/configure
+++ b/configure
@@ -228,15 +228,15 @@ version_ge () {
while true; do
set x $local_ver1
local_first=${2-0}
- # shift 2 does nothing if there are less than 2 arguments
- shift; shift
+ # 'shift 2' if $2 is set, or 'shift' if $2 is not set
+ shift ${2:+2}
local_ver1=$*
set x $local_ver2
# the second argument finished, the first must be greater or equal
test $# = 1 && return 0
test $local_first -lt $2 && return 1
test $local_first -gt $2 && return 0
- shift; shift
+ shift ${2:+2}
local_ver2=$*
done
}
--
2.26.2
next prev parent reply other threads:[~2020-08-21 21:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-21 21:14 [PULL 0/6] Meson build system fixes Paolo Bonzini
2020-08-21 21:14 ` [PULL 1/6] target/s390x: fix meson.build issue Paolo Bonzini
2020-08-21 21:14 ` [PULL 2/6] util/meson.build: fix fdmon-io_uring build Paolo Bonzini
2020-08-21 21:14 ` Paolo Bonzini [this message]
2020-08-21 21:14 ` [PULL 4/6] meson: convert pc-bios/keymaps/Makefile Paolo Bonzini
2020-08-21 21:14 ` [PULL 5/6] meson: Fix --disable-tools --enable-system builds Paolo Bonzini
2020-08-21 21:14 ` [PULL 6/6] keymaps: update Paolo Bonzini
2020-08-22 22:51 ` [PULL 0/6] Meson build system fixes Peter Maydell
2020-08-23 10:52 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200821211412.17321-4-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).