Skip to contentSkip to conversation

tst_kvercmp.sh: strip '+' when $(EXTRAVERSION) is blank

PATCH zhaogongyi via ltp 2 participants 2 messages Jun 7, 2022

lore
Share & tools
lore
#0 lore raw

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

Quoted 20 lines

Hi Zhao,

Quoted 4 lines

$(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.

...

Quoted 2 lines

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

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Zhao,

Quoted 7 lines

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

Quoted 2 lines

Best wishes,
Gongyi

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp