scripts: coccicheck: Correct usage of make coccicheck
PATCH v2 1/1 scripts: coccicheck: Correct usage of make coccicheck
The command "make coccicheck C=1 CHECK=scripts/coccicheck" results in the error:
./scripts/coccicheck: line 65: -1: shift count out of range
This happens because every time the C variable is specified, the shell arguments need to be "shifted" in order to take only the last argument, which is the C file to test. These shell arguments mostly comprise flags that have been set in the Makefile. However, when coccicheck is specified in the make command as a rule, the number of shell arguments is zero, thus passing the invalid value -1 to the shift command, resulting in an error.
Modify coccicheck to print correct usage of make coccicheck so as to avoid the error.
---
Changes in v2:
- Move test to only display error message
--- scripts/coccicheck | 12 ++++++++++++ 1 file changed, 12 insertions(+)
scripts/coccicheck +12 -0
@@ -61,6 +61,18 @@ COCCIINCLUDE=${COCCIINCLUDE// -include/ --include} if [ "$C" = "1" -o "$C" = "2" ]; then ONLINE=1 + if [[ $# -le 0 ]]; then + echo '' + echo 'Specifying both the variable "C" and rule "coccicheck" in the make +command results in a shift count error.' + echo '' + echo 'Try specifying "scripts/coccicheck" as a value for the CHECK variable instead.' + echo '' + echo 'Example: make C=2 CHECK=scripts/coccicheck drivers/staging/wfx/hi_t.o' + echo '' + exit 1 + fi + # Take only the last argument, which is the C file to test shift $(( $# - 1 )) OPTIONS="$COCCIINCLUDE $1"
Signature · 1 line
2.25.1
Julia Lawall
maintainerQuoted 29 lines · Sumera Priyadarsini
The command "make coccicheck C=1 CHECK=scripts/coccicheck" results in the error:
./scripts/coccicheck: line 65: -1: shift count out of rangeThis happens because every time the C variable is specified, the shell arguments need to be "shifted" in order to take only the last argument, which is the C file to test. These shell arguments mostly comprise flags that have been set in the
Makefile. However, when coccicheck is specified in the make command as a rule, the number of shell arguments is zero, thus passing the invalid value -1 to the shift command, resulting in an error.Modify coccicheck to print correct usage of make coccicheck so as to avoid the error.
Signed-off-by Sumera Priyadarsini <[email protected]>---
Changes in v2:
- Move test to only display error message--- scripts/coccicheck | 12 ++++++++++++ 1 file changed, 12 insertions(+)scripts/coccicheck +0
-0@@ -61,6 +61,18 @@ COCCIINCLUDE=${COCCIINCLUDE// -include/ --include} if [ "$C" = "1" -o "$C" = "2" ]; then
scripts/coccicheck COCCIINCLUDE=${COCCIINCLUDE// -include/ --include} · line 71
Quoted 10 lines
scripts/coccicheck +8
-0ONLINE=1 + if [[ $# -le 0 ]]; then + echo '' + echo 'Specifying both the variable "C" and rule "coccicheck" in the make +command results in a shift count error.' + echo '' + echo 'Try specifying "scripts/coccicheck" as a value for the CHECK variable instead.' + echo '' + echo 'Example: make C=2 CHECK=scripts/coccicheck drivers/staging/wfx/hi_t.o'
I think that this file doesn't exist any more. Even though you can't guarantee that any particular file will be around forever, a file in staging is probably not a good choice, since they are usually on their way in or on the way out of the kernel.
julia
Quoted 15 lines
scripts/coccicheck +4
-1+ echo '' + exit 1 + fi + # Take only the last argument, which is the C file to test shift $(( $# - 1 )) OPTIONS="$COCCIINCLUDE $1" --2.25.1
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 43 lines · Julia Lawall
Quoted 28 lines · Sumera Priyadarsini
The command "make coccicheck C=1 CHECK=scripts/coccicheck" results in the error:
./scripts/coccicheck: line 65: -1: shift count out of rangeThis happens because every time the C variable is specified, the shell arguments need to be "shifted" in order to take only the last argument, which is the C file to test. These shell arguments mostly comprise flags that have been set in the
Makefile. However, when coccicheck is specified in the make command as a rule, the number of shell arguments is zero, thus passing the invalid value -1 to the shift command, resulting in an error.Modify coccicheck to print correct usage of make coccicheck so as to avoid the error.
Signed-off-by Sumera Priyadarsini <[email protected]>---
Changes in v2:
- Move test to only display error message--- scripts/coccicheck | 12 ++++++++++++ 1 file changed, 12 insertions(+)scripts/coccicheck +0
-0scripts/coccicheck COCCIINCLUDE=${COCCIINCLUDE// -include/ --include} · line 66
Quoted 6 lines
scripts/coccicheck +3
-0@@ -61,6 +61,18 @@ COCCIINCLUDE=${COCCIINCLUDE// -include/ --include} if [ "$C" = "1" -o "$C" = "2" ]; then ONLINE=1 + if [[ $# -le 0 ]]; then + echo '' + echo 'Specifying both the variable "C" and rule "coccicheck"in the make
scripts/coccicheck COCCIINCLUDE=${COCCIINCLUDE// -include/ --include}
Quoted 3 lines
scripts/coccicheck +3
-0+command results in a shift count error.' + echo '' + echo 'Try specifying "scripts/coccicheck" as a value for theCHECK variable instead.'
Quoted 9 lines
scripts/coccicheck COCCIINCLUDE=${COCCIINCLUDE// -include/ --include} · line 71
Quoted 2 lines
scripts/coccicheck +2
-0+ echo '' + echo 'Example: make C=2 CHECK=scripts/coccicheck
drivers/staging/wfx/hi_t.o'I think that this file doesn't exist any more. Even though you can't guarantee that any particular file will be around forever, a file in staging is probably not a good choice, since they are usually on their way in or on the way out of the kernel.
Fair, I will send a v3 with a better example.
regards,
sumera
Quoted 18 lines
julia
Quoted 15 lines
scripts/coccicheck +4
-1+ echo '' + exit 1 + fi + # Take only the last argument, which is the C file to test shift $(( $# - 1 )) OPTIONS="$COCCIINCLUDE $1" --2.25.1
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci