]> sourceware.org Git - lvm2.git/commitdiff
tests: Fix unbound variable
authorMarian Csontos <mcsontos@redhat.com>
Tue, 23 Jul 2019 13:36:13 +0000 (15:36 +0200)
committerMarian Csontos <mcsontos@redhat.com>
Wed, 24 Jul 2019 14:30:15 +0000 (16:30 +0200)
Test `aux kernel_at_least 5 1` fails even for newer kernel
with `$3: unbound variable` when using `set -u`.

test/lib/aux.sh

index 0cc26a4309c1d2a312a2492c149dbf34f1a772be..e3f624cda870fb9fb5542da5d887e31d1ddbe559 100644 (file)
@@ -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
 }
 #
This page took 0.04069 seconds and 5 git commands to generate.