1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

tests: Fix unbound variable

Test `aux kernel_at_least 5 1` fails even for newer kernel
with `$3: unbound variable` when using `set -u`.
This commit is contained in:
Marian Csontos 2019-07-23 15:36:13 +02:00
parent aa58f9bd9b
commit dd19fa9ff3

View File

@ -1387,17 +1387,17 @@ version_at_least() {
IFS=".-" read -r major minor revision <<< "$1" IFS=".-" read -r major minor revision <<< "$1"
shift shift
test -z "${1:-}" && return 0 test -n "${1:-}" || return 0
test -n "$major" || return 1 test -n "$major" || return 1
test "$major" -gt "$1" && return 0 test "$major" -gt "$1" && return 0
test "$major" -eq "$1" || return 1 test "$major" -eq "$1" || return 1
test -n "$2" || return 0 test -n "${2:-}" || return 0
test -n "$minor" || return 1 test -n "$minor" || return 1
test "$minor" -gt "$2" && return 0 test "$minor" -gt "$2" && return 0
test "$minor" -eq "$2" || return 1 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 test "$revision" -ge "$3" 2>/dev/null || return 1
} }
# #