* [PATCH v2] scripts: coccicheck: Correct usage of make coccicheck
@ 2020-11-18 8:27 ` Sumera Priyadarsini
0 siblings, 0 replies; 5+ messages in thread
From: Sumera Priyadarsini @ 2020-11-18 8:27 UTC (permalink / raw)
To: Julia.Lawall
Cc: Gilles.Muller, nicolas.palix, michal.lkml, cocci, linux-kernel
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.
Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
---
Changes in v2:
- Move test to only display error message
---
scripts/coccicheck | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/scripts/coccicheck b/scripts/coccicheck
index 209bb0427b43..f3b8bf505c5f 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -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"
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Cocci] [PATCH v2] scripts: coccicheck: Correct usage of make coccicheck
@ 2020-11-18 8:27 ` Sumera Priyadarsini
0 siblings, 0 replies; 5+ messages in thread
From: Sumera Priyadarsini @ 2020-11-18 8:27 UTC (permalink / raw)
To: Julia.Lawall
Cc: linux-kernel, michal.lkml, nicolas.palix, cocci, Gilles.Muller
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.
Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
---
Changes in v2:
- Move test to only display error message
---
scripts/coccicheck | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/scripts/coccicheck b/scripts/coccicheck
index 209bb0427b43..f3b8bf505c5f 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -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"
--
2.25.1
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Cocci] [PATCH v2] scripts: coccicheck: Correct usage of make coccicheck
2020-11-18 8:27 ` [Cocci] " Sumera Priyadarsini
@ 2020-11-23 21:06 ` Julia Lawall
-1 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2020-11-23 21:06 UTC (permalink / raw)
To: Sumera Priyadarsini
Cc: linux-kernel, michal.lkml, nicolas.palix, cocci, Gilles.Muller
On Wed, 18 Nov 2020, Sumera Priyadarsini wrote:
> 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.
>
> Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
> ---
> Changes in v2:
> - Move test to only display error message
> ---
> scripts/coccicheck | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index 209bb0427b43..f3b8bf505c5f 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -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'
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
> + 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
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Cocci] [PATCH v2] scripts: coccicheck: Correct usage of make coccicheck
@ 2020-11-23 21:06 ` Julia Lawall
0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2020-11-23 21:06 UTC (permalink / raw)
To: Sumera Priyadarsini
Cc: Gilles.Muller, michal.lkml, nicolas.palix, linux-kernel, cocci
On Wed, 18 Nov 2020, Sumera Priyadarsini wrote:
> 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.
>
> Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
> ---
> Changes in v2:
> - Move test to only display error message
> ---
> scripts/coccicheck | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index 209bb0427b43..f3b8bf505c5f 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -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'
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
> + 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
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Cocci] [PATCH v2] scripts: coccicheck: Correct usage of make coccicheck
2020-11-23 21:06 ` Julia Lawall
(?)
@ 2020-11-24 20:18 ` Sumera Priyadarsini
-1 siblings, 0 replies; 5+ messages in thread
From: Sumera Priyadarsini @ 2020-11-24 20:18 UTC (permalink / raw)
To: Julia Lawall
Cc: Gilles Muller, Michal Marek, Nicolas Palix, linux-kernel, Coccinelle
[-- Attachment #1.1: Type: text/plain, Size: 2540 bytes --]
On Tue, Nov 24, 2020 at 2:36 AM Julia Lawall <julia.lawall@inria.fr> wrote:
>
>
> On Wed, 18 Nov 2020, Sumera Priyadarsini wrote:
>
> > 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.
> >
> > Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
> > ---
> > Changes in v2:
> > - Move test to only display error message
> > ---
> > scripts/coccicheck | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/scripts/coccicheck b/scripts/coccicheck
> > index 209bb0427b43..f3b8bf505c5f 100755
> > --- a/scripts/coccicheck
> > +++ b/scripts/coccicheck
> > @@ -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'
>
> 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
> julia
>
> > + 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
> > Cocci@systeme.lip6.fr
> > https://systeme.lip6.fr/mailman/listinfo/cocci
> >
>
[-- Attachment #1.2: Type: text/html, Size: 3866 bytes --]
[-- Attachment #2: Type: text/plain, Size: 136 bytes --]
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-11-24 20:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 8:27 [PATCH v2] scripts: coccicheck: Correct usage of make coccicheck Sumera Priyadarsini
2020-11-18 8:27 ` [Cocci] " Sumera Priyadarsini
2020-11-23 21:06 ` Julia Lawall
2020-11-23 21:06 ` Julia Lawall
2020-11-24 20:18 ` Sumera Priyadarsini
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.