diff mbox series

[kvm-unit-tests] configure: Add a check for the bash version

Message ID 20200925143852.227908-1-thuth@redhat.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests] configure: Add a check for the bash version | expand

Commit Message

Thomas Huth Sept. 25, 2020, 2:38 p.m. UTC
Our scripts do not work with older versions of the bash, like the
default Bash 3 from macOS (e.g. we use the "|&" operator which has
been introduced in Bash 4.0). Add a check to make sure that we use
at least version 4 to avoid that the users run into problems later.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Paolo Bonzini Sept. 25, 2020, 2:45 p.m. UTC | #1
On 25/09/20 16:38, Thomas Huth wrote:
> Our scripts do not work with older versions of the bash, like the
> default Bash 3 from macOS (e.g. we use the "|&" operator which has
> been introduced in Bash 4.0). Add a check to make sure that we use
> at least version 4 to avoid that the users run into problems later.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  configure | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/configure b/configure
> index f930543..39b63ae 100755
> --- a/configure
> +++ b/configure
> @@ -1,5 +1,10 @@
>  #!/usr/bin/env bash
>  
> +if [ -z "${BASH_VERSINFO[0]}" ] || [ "${BASH_VERSINFO[0]}" -lt 4 ] ; then
> +    echo "Error: Bash version 4 or newer is required for the kvm-unit-tests"
> +    exit 1
> +fi
> +
>  srcdir=$(cd "$(dirname "$0")"; pwd)
>  prefix=/usr/local
>  cc=gcc
> 

Looks good, would you like me to apply it or do you prefer to send a
pull request once you have more stuff?

Paolo
Thomas Huth Sept. 25, 2020, 4:33 p.m. UTC | #2
On 25/09/2020 16.45, Paolo Bonzini wrote:
> On 25/09/20 16:38, Thomas Huth wrote:
>> Our scripts do not work with older versions of the bash, like the
>> default Bash 3 from macOS (e.g. we use the "|&" operator which has
>> been introduced in Bash 4.0). Add a check to make sure that we use
>> at least version 4 to avoid that the users run into problems later.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>  configure | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/configure b/configure
>> index f930543..39b63ae 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1,5 +1,10 @@
>>  #!/usr/bin/env bash
>>  
>> +if [ -z "${BASH_VERSINFO[0]}" ] || [ "${BASH_VERSINFO[0]}" -lt 4 ] ; then
>> +    echo "Error: Bash version 4 or newer is required for the kvm-unit-tests"
>> +    exit 1
>> +fi
>> +
>>  srcdir=$(cd "$(dirname "$0")"; pwd)
>>  prefix=/usr/local
>>  cc=gcc
>>
> 
> Looks good, would you like me to apply it or do you prefer to send a
> pull request once you have more stuff?

I can put it into my next pull request.

 Thomas
diff mbox series

Patch

diff --git a/configure b/configure
index f930543..39b63ae 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,10 @@ 
 #!/usr/bin/env bash
 
+if [ -z "${BASH_VERSINFO[0]}" ] || [ "${BASH_VERSINFO[0]}" -lt 4 ] ; then
+    echo "Error: Bash version 4 or newer is required for the kvm-unit-tests"
+    exit 1
+fi
+
 srcdir=$(cd "$(dirname "$0")"; pwd)
 prefix=/usr/local
 cc=gcc