Skip to contentSkip to conversation

tests/check-block: Do not run the iotests with old versions of bash

PATCH Superseded Thomas Huth 4 participants 10 messages Sep 12, 2020 – Sep 14, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/check-block: Do not run the iotests with old versions of bash

macOS is shipped with a very old version of the bash (3.2), which is currently not suitable for running the iotests anymore. Add a check to skip the iotests in this case - if someone still wants to run the iotests on macOS, they can install a newer version from homebrew, for example.

---
 tests/check-block.sh | 5 +++++
 1 file changed, 5 insertions(+)
tests/check-block.sh +5 -0
index 8e29c868e5..bfe1630c1e 100755
@@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then
     exit 0
 fi
 
+if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; then
+    echo "bash version too old ==> Not running the qemu-iotests."
+    exit 0
+fi
+
 if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then
     if ! command -v gsed >/dev/null 2>&1; then
         echo "GNU sed not available ==> Not running the qemu-iotests."
Signature · 1 line
2.18.2
#1 lore raw
Quoted 16 lines · Thomas Huth

macOS is shipped with a very old version of the bash (3.2), which is currently not suitable for running the iotests anymore. Add a check to skip the iotests in this case - if someone still wants to run the iotests on macOS, they can install a newer version from homebrew, for example.

---
 tests/check-block.sh | 5 +++++
 1 file changed, 5 insertions(+)
tests/check-block.sh +0 -0
index 8e29c868e5..bfe1630c1e 100755

tests/check-block.sh if ! command -v bash >/dev/null 2>&1 ; then · line 49

Quoted 4 lines
tests/check-block.sh +1 -0
@@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then
     exit 0
 fi
 
+if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; then

grep -q instead of the redirections, perhaps?

But more importantly, I think this needs a LANG=C prefix. (If I expand the rejected major versions to [12345], it doesn’t skip without a prefix, because the string reads “GNU bash, Version 5...” here in LANG=de_DE.UTF-8.)

Max

Quoted 8 lines
tests/check-block.sh +4 -0
+    echo "bash version too old ==> Not running the qemu-iotests."
+    exit 0
+fi
+
 if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then
     if ! command -v gsed >/dev/null 2>&1; then
         echo "GNU sed not available ==> Not running the qemu-iotests."
#2 lore raw
Quoted 20 lines · Max Reitz
Quoted 19 lines · Thomas Huth

macOS is shipped with a very old version of the bash (3.2), which is currently not suitable for running the iotests anymore. Add a check to skip the iotests in this case - if someone still wants to run the iotests on macOS, they can install a newer version from homebrew, for example.

---
 tests/check-block.sh | 5 +++++
 1 file changed, 5 insertions(+)
tests/check-block.sh +0 -0
index 8e29c868e5..bfe1630c1e 100755
@@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then
     exit 0
 fi
 
Quoted 8 lines

tests/check-block.sh if ! command -v bash >/dev/null 2>&1 ; then · line 49

Quoted 1 line
tests/check-block.sh +1 -0
+if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; then

grep -q instead of the redirections, perhaps?

But more importantly, I think this needs a LANG=C prefix. (If I expand the rejected major versions to [12345], it doesn’t skip without a prefix, because the string reads “GNU bash, Version 5...” here in LANG=de_DE.UTF-8.)

Ouch, ok. But actually, I'm not quite sure anymore whether the patch is really required. I ran into the "readlink -f" problem and thought that it occurred due to the ancient version of bash on macOS, but as a I now know, readlink is a separate program and not a bash built-in, so it's a different issue... thus let's skip this patch here for now until we hit a real issue with bash again.

Thomas

#3 lore raw
Quoted 30 lines · Thomas Huth
Quoted 20 lines · Max Reitz
Quoted 19 lines · Thomas Huth

macOS is shipped with a very old version of the bash (3.2), which is currently not suitable for running the iotests anymore. Add a check to skip the iotests in this case - if someone still wants to run the iotests on macOS, they can install a newer version from homebrew, for example.

---
 tests/check-block.sh | 5 +++++
 1 file changed, 5 insertions(+)
tests/check-block.sh +0 -0
index 8e29c868e5..bfe1630c1e 100755
@@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then
     exit 0
 fi
 
Quoted 8 lines

tests/check-block.sh if ! command -v bash >/dev/null 2>&1 ; then · line 49

Quoted 1 line
tests/check-block.sh +1 -0
+if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; then

grep -q instead of the redirections, perhaps?

But more importantly, I think this needs a LANG=C prefix. (If I expand the rejected major versions to [12345], it doesn’t skip without a prefix, because the string reads “GNU bash, Version 5...” here in LANG=de_DE.UTF-8.)

Quoted 6 lines

Ouch, ok. But actually, I'm not quite sure anymore whether the patch is really required. I ran into the "readlink -f" problem and thought that it occurred due to the ancient version of bash on macOS, but as a I now know, readlink is a separate program and not a bash built-in, so it's a different issue... thus let's skip this patch here for now until we hit a real issue with bash again.

Yes, I had hoped this patch would fix that issue. Or perhaps at least hide it, because if you have a newer bash, chances are your readlink has -f, too.

So should we just effectively revert b1cbc33a397 if readlink -f didn’t work, i.e. check "$?" and on failure use $PWD as it was before b1cbc33a397?

Max

#4 lore raw
Quoted 38 lines · Max Reitz
Quoted 30 lines · Thomas Huth
Quoted 20 lines · Max Reitz
Quoted 19 lines · Thomas Huth

macOS is shipped with a very old version of the bash (3.2), which is currently not suitable for running the iotests anymore. Add a check to skip the iotests in this case - if someone still wants to run the iotests on macOS, they can install a newer version from homebrew, for example.

---
 tests/check-block.sh | 5 +++++
 1 file changed, 5 insertions(+)
tests/check-block.sh +0 -0
index 8e29c868e5..bfe1630c1e 100755
@@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then
     exit 0
 fi
 
Quoted 8 lines

tests/check-block.sh if ! command -v bash >/dev/null 2>&1 ; then · line 49

Quoted 1 line
tests/check-block.sh +1 -0
+if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; then

grep -q instead of the redirections, perhaps?

But more importantly, I think this needs a LANG=C prefix. (If I expand the rejected major versions to [12345], it doesn’t skip without a prefix, because the string reads “GNU bash, Version 5...” here in LANG=de_DE.UTF-8.)

Quoted 6 lines

Ouch, ok. But actually, I'm not quite sure anymore whether the patch is really required. I ran into the "readlink -f" problem and thought that it occurred due to the ancient version of bash on macOS, but as a I now know, readlink is a separate program and not a bash built-in, so it's a different issue... thus let's skip this patch here for now until we hit a real issue with bash again.

Quoted 6 lines

Yes, I had hoped this patch would fix that issue. Or perhaps at least hide it, because if you have a newer bash, chances are your readlink has -f, too.

So should we just effectively revert b1cbc33a397 if readlink -f didn’t work, i.e. check "$?" and on failure use $PWD as it was before b1cbc33a397?

Sounds like the best option that I currently can see, indeed. Want me to send a patch, or will you provide one?

Thomas

#5 lore raw
In reply to Thomas Huth
Quoted 17 lines · Thomas Huth

macOS is shipped with a very old version of the bash (3.2), which is currently not suitable for running the iotests anymore. Add a check to skip the iotests in this case - if someone still wants to run the iotests on macOS, they can install a newer version from homebrew, for example.

---
 tests/check-block.sh | 5 +++++
 1 file changed, 5 insertions(+)
tests/check-block.sh +0 -0
index 8e29c868e5..bfe1630c1e 100755

tests/check-block.sh if ! command -v bash >/dev/null 2>&1 ; then · line 49

Quoted 4 lines
tests/check-block.sh +1 -0
@@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then
     exit 0
 fi
 
+if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ;

then

Quoted 11 lines
tests/check-block.sh +4 -1
+    echo "bash version too old ==> Not running the qemu-iotests."
+    exit 0
+fi
+
 if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then
     if ! command -v gsed >/dev/null 2>&1; then
         echo "GNU sed not available ==> Not running the qemu-iotests."
--

2.18.2

Is that worth to convert the check-block.sh script to python script? so it can even running under msys2/mingw?

--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo

#6 lore raw
Quoted 26 lines · 罗勇刚(Yonggang Luo)
Quoted 20 lines · On Sat, Sep 12, 2020 at 8:16 PM Thomas Huth <[email protected]…

macOS is shipped with a very old version of the bash (3.2), which is currently not suitable for running the iotests anymore. Add a check to skip the iotests in this case - if someone still wants to run the iotests on macOS, they can install a newer version from homebrew, for example.

Signed-off-by Thomas Huth <[email protected] <mailto:[email protected]>>

---
 tests/check-block.sh | 5 +++++

 1 file changed, 5 insertions(+)
tests/check-block.sh +0 -0
index 8e29c868e5..bfe1630c1e 100755
@@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then

     exit 0
 fi

Quoted 1 line

+if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ;

then

Quoted 13 lines
Quoted 11 lines

+    echo "bash version too old ==> Not running the qemu-iotests."
+    exit 0

tests/check-block.sh +2 -0
+fi
+

 if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then if ! command -v gsed >/dev/null 2>&1; then
         echo "GNU sed not available ==> Not running the qemu-iotests." --
2.18.2

Is that worth to convert the check-block.sh script to python script? so it can even running under msys2/mingw?

No, you need bash for the various iotest anyway.

Thomas

#7 lore raw
In reply to Thomas Huth
Quoted 16 lines · Thomas Huth

macOS is shipped with a very old version of the bash (3.2), which is currently not suitable for running the iotests anymore. Add a check to skip the iotests in this case - if someone still wants to run the iotests on macOS, they can install a newer version from homebrew, for example.

---
  tests/check-block.sh | 5 +++++
  1 file changed, 5 insertions(+)
tests/check-block.sh +0 -0
index 8e29c868e5..bfe1630c1e 100755

tests/check-block.sh if ! command -v bash >/dev/null 2>&1 ; then · line 49

Quoted 4 lines
tests/check-block.sh +1 -0
@@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then
      exit 0
  fi
 
+if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; then

We're already running bash - why do we need to spawn another bash and a grep, when we can just check $BASH_VERSION?

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#8 lore raw
Quoted 12 lines · Eric Blake
Quoted 11 lines · Thomas Huth

macOS is shipped with a very old version of the bash (3.2), which is currently not suitable for running the iotests anymore. Add a check to skip the iotests in this case - if someone still wants to run the iotests on macOS, they can install a newer version from homebrew, for example.

---
  tests/check-block.sh | 5 +++++

  1 file changed, 5 insertions(+)
Quoted 12 lines
Quoted 9 lines
tests/check-block.sh +0 -0
index 8e29c868e5..bfe1630c1e 100755
@@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then

      exit 0
  fi
  +if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; then

We're already running bash - why do we need to spawn another bash and a grep, when we can just check $BASH_VERSION?

tests/check-block.sh uses "#!/bin/sh", so it could be running with a different kind of shell, I think.

Thomas

#9 lore raw
Quoted 26 lines · Thomas Huth
Quoted 12 lines · Eric Blake
Quoted 11 lines · Thomas Huth

macOS is shipped with a very old version of the bash (3.2), which is currently not suitable for running the iotests anymore. Add a check to skip the iotests in this case - if someone still wants to run the iotests on macOS, they can install a newer version from homebrew, for example.

---
   tests/check-block.sh | 5 +++++
   1 file changed, 5 insertions(+)
Quoted 12 lines
Quoted 9 lines
tests/check-block.sh +0 -0
index 8e29c868e5..bfe1630c1e 100755
@@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then
       exit 0
   fi
   +if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1

; then

We're already running bash - why do we need to spawn another bash and a grep, when we can just check $BASH_VERSION?

Quoted 2 lines

tests/check-block.sh uses "#!/bin/sh", so it could be running with a different kind of shell, I think.

Ah, right; I'm so used to most of our testsuite demanding bash that I forgot to check that this script sticks to the smaller subset of /bin/sh portability.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org