From dd19fa9ff36ce8a17452f83e6264bbf6c34f83ae Mon Sep 17 00:00:00 2001 From: Marian Csontos Date: Tue, 23 Jul 2019 15:36:13 +0200 Subject: [PATCH] tests: 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 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/lib/aux.sh b/test/lib/aux.sh index 0cc26a430..e3f624cda 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 -n "${1:-}" || return 0 test -n "$major" || return 1 test "$major" -gt "$1" && return 0 test "$major" -eq "$1" || return 1 - test -n "$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 -n "$3" || return 0 + test -n "${3:-}" || return 0 test "$revision" -ge "$3" 2>/dev/null || return 1 } #