All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] tst_kvercmp.sh: strip '+' when $(EXTRAVERSION) is blank
@ 2022-06-06 11:36 Zhao Gongyi via ltp
  2022-06-06 18:53 ` Petr Vorel
  0 siblings, 1 reply; 4+ messages in thread
From: Zhao Gongyi via ltp @ 2022-06-06 11:36 UTC (permalink / raw)
  To: ltp

$(EXTRAVERSION) defines an even tinier sublevel for pre-patches
or additional patches. It is usually some non-numeric string
such as "-pre4", and is often blank. When $(EXTRAVERSION) is blank,
there may be a extra '+' which shoud be stripped.

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
 testcases/open_posix_testsuite/scripts/tst_kvercmp.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/testcases/open_posix_testsuite/scripts/tst_kvercmp.sh b/testcases/open_posix_testsuite/scripts/tst_kvercmp.sh
index 69466bb12..ce1d13c72 100755
--- a/testcases/open_posix_testsuite/scripts/tst_kvercmp.sh
+++ b/testcases/open_posix_testsuite/scripts/tst_kvercmp.sh
@@ -10,6 +10,7 @@ r1=$(echo ${ker_ver} | awk -F. '{print $1}')
 r2=$(echo ${ker_ver} | awk -F. '{print $2}')
 r3=$(echo ${ker_ver} | awk -F. '{print $3}')
 r3=${r3%%-*}
+r3=${r3%%+*}

 test_ver=$(($1 * 65536 + $2 * 256 + $3))
 curr_ver=$((${r1} * 65536 + ${r2} * 256 + ${r3}))
--
2.17.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH] tst_kvercmp.sh: strip '+' when $(EXTRAVERSION) is blank
  2022-06-06 11:36 [LTP] [PATCH] tst_kvercmp.sh: strip '+' when $(EXTRAVERSION) is blank Zhao Gongyi via ltp
@ 2022-06-06 18:53 ` Petr Vorel
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2022-06-06 18:53 UTC (permalink / raw)
  To: Zhao Gongyi; +Cc: ltp

Hi Zhao,

> $(EXTRAVERSION) defines an even tinier sublevel for pre-patches
> or additional patches. It is usually some non-numeric string
> such as "-pre4", and is often blank. When $(EXTRAVERSION) is blank,
> there may be a extra '+' which shoud be stripped.
...
>  r3=${r3%%-*}
> +r3=${r3%%+*}

Is that '+' on kernel which sources were modified without commit?
This can be on version with non-blank EXTRAVERSION, but in that case it's
already removed by r3=${r3%%-*}, right?

LGTM
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH] tst_kvercmp.sh: strip '+' when $(EXTRAVERSION) is blank
  2022-06-07  2:14 zhaogongyi via ltp
@ 2022-06-07 15:04 ` Petr Vorel
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2022-06-07 15:04 UTC (permalink / raw)
  To: zhaogongyi; +Cc: ltp

Hi Zhao,

> Hi Petr,

> Yes, if EXTRAVERSION is set to "-*", it has been stripped, but EXTRAVERSION also can be set to blank and sources were modified without commit, In this case,
> we run 'make clean' or 'make' would report error like:

> ./scripts/tst_kvercmp.sh: line 16: 5 * 65536 + 10 * 256 + 0+: syntax error: operand expected (error token is "+")
> ./scripts/tst_kvercmp.sh: line 17: [: -ge: unary operator expected

Thanks for info, merged.

For removing trailing + just single % would be enough, but two should not harm,
therefore I merged it without modification.

Kind regards,
Petr

> Best wishes,
> Gongyi

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH] tst_kvercmp.sh: strip '+' when $(EXTRAVERSION) is blank
@ 2022-06-07  2:14 zhaogongyi via ltp
  2022-06-07 15:04 ` Petr Vorel
  0 siblings, 1 reply; 4+ messages in thread
From: zhaogongyi via ltp @ 2022-06-07  2:14 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi Petr,

Yes, if EXTRAVERSION is set to "-*", it has been stripped, but EXTRAVERSION also can be set to blank and sources were modified without commit, In this case,
we run 'make clean' or 'make' would report error like:

./scripts/tst_kvercmp.sh: line 16: 5 * 65536 + 10 * 256 + 0+: syntax error: operand expected (error token is "+")
./scripts/tst_kvercmp.sh: line 17: [: -ge: unary operator expected
 
Best wishes,
Gongyi

> 
> Hi Zhao,
> 
> > $(EXTRAVERSION) defines an even tinier sublevel for pre-patches or
> > additional patches. It is usually some non-numeric string such as
> > "-pre4", and is often blank. When $(EXTRAVERSION) is blank, there may
> > be a extra '+' which shoud be stripped.
> ...
> >  r3=${r3%%-*}
> > +r3=${r3%%+*}
> 
> Is that '+' on kernel which sources were modified without commit?
> This can be on version with non-blank EXTRAVERSION, but in that case it's
> already removed by r3=${r3%%-*}, right?
> 
> LGTM
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> 
> Kind regards,
> Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2022-06-07 15:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06 11:36 [LTP] [PATCH] tst_kvercmp.sh: strip '+' when $(EXTRAVERSION) is blank Zhao Gongyi via ltp
2022-06-06 18:53 ` Petr Vorel
2022-06-07  2:14 zhaogongyi via ltp
2022-06-07 15:04 ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.