[lvm-devel] master - test: Fix unbound variable

Marian Csontos mcsontos at sourceware.org
Thu Jun 27 09:14:54 UTC 2019


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=09f29570f2dac1a84f5ee24107df6461194b269a
Commit:        09f29570f2dac1a84f5ee24107df6461194b269a
Parent:        9ba45d824adc91b5767fd7a26c3ba83f7b23b250
Author:        Marian Csontos <mcsontos at redhat.com>
AuthorDate:    Thu Jun 27 10:41:21 2019 +0200
Committer:     Marian Csontos <mcsontos at redhat.com>
CommitterDate: Thu Jun 27 10:41:21 2019 +0200

test: Fix unbound variable

Test `aux kernel_at_least 5 1` fails even for newer kernel
with `$3: unbound variable` when using `set -u`.
---
 test/lib/aux.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 09ef9ed..0cc26a4 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1387,17 +1387,17 @@ version_at_least() {
 	IFS=".-" read -r major minor revision <<< "$1"
 	shift
 
-	test -z "$1" && return 0
+	test -z "${1:-}" && return 0
 	test -n "$major" || return 1
 	test "$major" -gt "$1" && return 0
 	test "$major" -eq "$1" || return 1
 
-	test -z "$2" && return 0
+	test -n "$2" || return 0
 	test -n "$minor" || return 1
 	test "$minor" -gt "$2" && return 0
 	test "$minor" -eq "$2" || return 1
 
-	test -z "$3" && return 0
+	test -n "$3" || return 0
 	test "$revision" -ge "$3" 2>/dev/null || return 1
 }
 #




More information about the lvm-devel mailing list