qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH] configure: Escape non-numbers in version_ge()
Date: Tue,  2 Feb 2021 11:49:11 +0100	[thread overview]
Message-ID: <20210202104911.879393-1-philmd@redhat.com> (raw)

On Red Hat based distributions, the configure script emits various
warnings:

  # ./configure
  Using './build' as the directory for build output
  ./configure: line 212: test: 2-15: integer expression expected
  ./configure: line 213: test: 2-15: integer expression expected
  ./configure: line 212: test: el8: integer expression expected
  ./configure: line 213: test: el8: integer expression expected

This is produced by the gdb version check introduced in commit
b1863ccc957 ("configure: gate our use of GDB to 8.3.1 or above"):

    gdb_version=$($gdb_bin --version | head -n 1)
    if version_ge ${gdb_version##* } 8.3.1; then
        echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak
    fi

Because on RHEL/Fedora the minor version is not a plain number:

  $ gdb --version | head -n 1
  GNU gdb (GDB) Fedora 9.1-7.fc32

  $ gdb --version | head -n 1
  GNU gdb (GDB) Red Hat Enterprise Linux 8.2-15.el8

Fix by only using the leading numbers, stripping the rest.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index e85d6baf8f8..21f6530a812 100755
--- a/configure
+++ b/configure
@@ -205,7 +205,7 @@ version_ge () {
         local_first=${2-0}
         # 'shift 2' if $2 is set, or 'shift' if $2 is not set
         shift ${2:+2}
-        local_ver1=$*
+        local_ver1=$(echo $* | sed -E 's/(^[0-9]+).*/\1/')
         set x $local_ver2
         # the second argument finished, the first must be greater or equal
         test $# = 1 && return 0
-- 
2.26.2



             reply	other threads:[~2021-02-02 10:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02 10:49 Philippe Mathieu-Daudé [this message]
2021-02-02 12:43 ` [PATCH] configure: Escape non-numbers in version_ge() Alex Bennée
2021-02-02 13:25   ` Philippe Mathieu-Daudé

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=20210202104911.879393-1-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /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).