Skip to contentSkip to conversation

master - test: Fix unbound variable

PATCH Marian Csontos 1 participant 1 message Jun 27, 2019

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=09f29570f2dac1a84f5ee24107df6461194b269a
Commit:        09f29570f2dac1a84f5ee24107df6461194b269a
Parent:        9ba45d824adc91b5767fd7a26c3ba83f7b23b250
Author:        Marian Csontos <[email protected]>
AuthorDate:    Thu Jun 27 10:41:21 2019 +0200
Committer:     Marian Csontos <[email protected]>
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(-)
test/lib/aux.sh +3 -3
index 09ef9ed..0cc26a4 100644
@@ -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
 }
 #