Linux block layer
 help / color / mirror / Atom feed
* [PATCH blktests] common/rc: fix kernel version parse failure
@ 2023-05-01  4:14 Shin'ichiro Kawasaki
  2023-05-01  4:32 ` Chaitanya Kulkarni
  2023-05-01 16:38 ` Bart Van Assche
  0 siblings, 2 replies; 4+ messages in thread
From: Shin'ichiro Kawasaki @ 2023-05-01  4:14 UTC (permalink / raw)
  To: linux-block; +Cc: Shin'ichiro Kawasaki

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>
---
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/rc b/common/rc
index af4c0b1..525867c 100644
--- 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/-.*//' | sed 's/[^.0-9]//')
 	if [ $((a * 65536 + b * 256 + c)) -lt $((d * 65536 + e * 256 + f)) ];
 	then
 		SKIP_REASONS+=("Kernel version too old")
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH blktests] common/rc: fix kernel version parse failure
  2023-05-01  4:14 [PATCH blktests] common/rc: fix kernel version parse failure Shin'ichiro Kawasaki
@ 2023-05-01  4:32 ` Chaitanya Kulkarni
  2023-05-01 16:38 ` Bart Van Assche
  1 sibling, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2023-05-01  4:32 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki, linux-block@vger.kernel.org

On 4/30/23 21:14, Shin'ichiro Kawasaki wrote:
> 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>
> ---
>   common/rc | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/rc b/common/rc
> index af4c0b1..525867c 100644
> --- 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/-.*//' | sed 's/[^.0-9]//')
>   	if [ $((a * 65536 + b * 256 + c)) -lt $((d * 65536 + e * 256 + f)) ];
>   	then
>   		SKIP_REASONS+=("Kernel version too old")

I was about to post the same fix as nvme queue count testcase if not running
with postfix letters. Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH blktests] common/rc: fix kernel version parse failure
  2023-05-01  4:14 [PATCH blktests] common/rc: fix kernel version parse failure Shin'ichiro Kawasaki
  2023-05-01  4:32 ` Chaitanya Kulkarni
@ 2023-05-01 16:38 ` Bart Van Assche
  2023-05-02  4:12   ` Shinichiro Kawasaki
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Van Assche @ 2023-05-01 16:38 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki, linux-block

On 4/30/23 21:14, Shin'ichiro Kawasaki wrote:
> 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>
> ---
>   common/rc | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/rc b/common/rc
> index af4c0b1..525867c 100644
> --- 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/-.*//' | sed 's/[^.0-9]//')
>   	if [ $((a * 65536 + b * 256 + c)) -lt $((d * 65536 + e * 256 + f)) ];
>   	then
>   		SKIP_REASONS+=("Kernel version too old")

Please combine the two sed statements into a single sed statement, e.g. as
follows:

sed 's/-.*//;s/[^.0-9]//'

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH blktests] common/rc: fix kernel version parse failure
  2023-05-01 16:38 ` Bart Van Assche
@ 2023-05-02  4:12   ` Shinichiro Kawasaki
  0 siblings, 0 replies; 4+ messages in thread
From: Shinichiro Kawasaki @ 2023-05-02  4:12 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: linux-block@vger.kernel.org

On May 01, 2023 / 09:38, Bart Van Assche wrote:
[...]
> Please combine the two sed statements into a single sed statement, e.g. as
> follows:
> 
> sed 's/-.*//;s/[^.0-9]//'

Thanks. I've applied the patch with the suggested change.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-02  4:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-01  4:14 [PATCH blktests] common/rc: fix kernel version parse failure Shin'ichiro Kawasaki
2023-05-01  4:32 ` Chaitanya Kulkarni
2023-05-01 16:38 ` Bart Van Assche
2023-05-02  4:12   ` Shinichiro Kawasaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox