]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
common/rc: fix kernel version parse failure
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Sat, 29 Apr 2023 10:55:36 +0000 (19:55 +0900)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tue, 2 May 2023 03:43:31 +0000 (12:43 +0900)
When kernel version numbers have postfix letters, _have_fio_ver fail to
parse the version. For example, uname -r returns "6.3.0+", it handles
"0+" as a number and fails to parse. Fix it by dropping all letters
other than numbers or period.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Link: https://lore.kernel.org/linux-block/20230501041415.49939-1-shinichiro.kawasaki@wdc.com/
common/rc

index af4c0b1cab22af3663a5b6f816b7e65a4ebd317a..21075767080f4f7a0ba45c9ab4457b8a0730086c 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -207,7 +207,7 @@ _have_kernel_option() {
 _have_kver() {
        local d=$1 e=$2 f=$3
 
-       IFS='.' read -r a b c < <(uname -r | sed 's/-.*//')
+       IFS='.' read -r a b c < <(uname -r | sed 's/-.*//;s/[^.0-9]//')
        if [ $((a * 65536 + b * 256 + c)) -lt $((d * 65536 + e * 256 + f)) ];
        then
                SKIP_REASONS+=("Kernel version too old")