From: Dmitry V. Levin Date: Fri, 23 Mar 2018 13:43:13 +0000 (+0000) Subject: tests: fix potentially unbound variable in kernel_version_code X-Git-Tag: v4.22~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73edd445e202772b80954203454c07ac183fa604;p=strace tests: fix potentially unbound variable in kernel_version_code Fix the following use case: $ sh -uc '. tests/init.sh; kernel_version_code 4.5' tests/init.sh: line 242: 3: unbound variable * tests/init.sh (kernel_version_code): Fix potentially unbound variable. --- diff --git a/tests/init.sh b/tests/init.sh index 4cb8f1ab..1f5ab49c 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -236,7 +236,7 @@ kernel_version_code() ( set -f IFS=. - set -- $1 + set -- $1 0 0 v1="${1%%[!0-9]*}" && [ -n "$v1" ] || v1=0 v2="${2%%[!0-9]*}" && [ -n "$v2" ] || v2=0 v3="${3%%[!0-9]*}" && [ -n "$v3" ] || v3=0