All of lore.kernel.org
 help / color / mirror / Atom feed
* Trying to use Coccinelle
@ 2020-03-11 18:11 Lourdes Pedrajas
  2020-03-11 23:23 ` [Outreachy kernel] " Stefano Brivio
  0 siblings, 1 reply; 19+ messages in thread
From: Lourdes Pedrajas @ 2020-03-11 18:11 UTC (permalink / raw)
  To: outreachy-kernel

Hello, I compiled Coccinelle successfully but maybe I am not getting it.
In order to try it in drivers/staging I ran e.g.:

make coccicheck MODE=patch M=drivers/staging/android/

and then got:

coccicheck failed
make: *** [coccicheck] Error 255
Makefile:1740: recipe for target 'coccicheck' failed.

Also tried some modifications of the command, read this documentation:
https://www.kernel.org/doc/html/latest/dev-tools/coccinelle.html and searched
how to use it, but nothing did help.

Only when I ran make coccicheck MODE=patch over entire sources it
produces some good results, but eventually I got

coccicheck failed
Makefile:1740: recipe for target 'coccicheck' failed
make: *** [coccicheck] Error 255

Am I missing something?
Sorry if this question is too obvious.

Lourdes


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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-11 18:11 Trying to use Coccinelle Lourdes Pedrajas
@ 2020-03-11 23:23 ` Stefano Brivio
  2020-03-13  9:40   ` Lourdes Pedrajas
  0 siblings, 1 reply; 19+ messages in thread
From: Stefano Brivio @ 2020-03-11 23:23 UTC (permalink / raw)
  To: Lourdes Pedrajas; +Cc: outreachy-kernel

On Wed, 11 Mar 2020 19:11:34 +0100
Lourdes Pedrajas <lu@pplo.net> wrote:

> Hello, I compiled Coccinelle successfully but maybe I am not getting it.
> In order to try it in drivers/staging I ran e.g.:
> 
> make coccicheck MODE=patch M=drivers/staging/android/
> 
> and then got:
> 
> coccicheck failed
> make: *** [coccicheck] Error 255
> Makefile:1740: recipe for target 'coccicheck' failed.
> 
> Also tried some modifications of the command, read this documentation:
> https://www.kernel.org/doc/html/latest/dev-tools/coccinelle.html and searched
> how to use it, but nothing did help.
> 
> Only when I ran make coccicheck MODE=patch over entire sources it
> produces some good results, but eventually I got
> 
> coccicheck failed
> Makefile:1740: recipe for target 'coccicheck' failed
> make: *** [coccicheck] Error 255

Can you share a bit more output? What comes before that?

-- 
Stefano



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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-11 23:23 ` [Outreachy kernel] " Stefano Brivio
@ 2020-03-13  9:40   ` Lourdes Pedrajas
  2020-03-16 14:08     ` Stefano Brivio
  0 siblings, 1 reply; 19+ messages in thread
From: Lourdes Pedrajas @ 2020-03-13  9:40 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: outreachy-kernel

On Thu, Mar 12, 2020 at 12:23:48AM +0100, Stefano Brivio wrote:
> On Wed, 11 Mar 2020 19:11:34 +0100
> Lourdes Pedrajas <lu@pplo.net> wrote:
> 
> > Hello, I compiled Coccinelle successfully but maybe I am not getting it.
> > In order to try it in drivers/staging I ran e.g.:
> > 
> > make coccicheck MODE=patch M=drivers/staging/android/
> > 
> > and then got:
> > 
> > coccicheck failed
> > make: *** [coccicheck] Error 255
> > Makefile:1740: recipe for target 'coccicheck' failed.
> > 
> > Also tried some modifications of the command, read this documentation:
> > https://www.kernel.org/doc/html/latest/dev-tools/coccinelle.html and searched
> > how to use it, but nothing did help.
> > 
> > Only when I ran make coccicheck MODE=patch over entire sources it
> > produces some good results, but eventually I got
> > 
> > coccicheck failed
> > Makefile:1740: recipe for target 'coccicheck' failed
> > make: *** [coccicheck] Error 255
> 
> Can you share a bit more output? What comes before that?
> 
> -- 
> Stefano
> 

Hi Stefano,

Indeed, this is all the output: (this command is run in the sources root
directory)

make coccicheck MODE=patch J=8 M=drivers/staging/android/

Please check for false positives in the output before submitting a patch.
When using "patch" mode, carefully review the patch before submitting it.

coccicheck failed
Makefile:1740: recipe for target 'coccicheck' failed
make: *** [coccicheck] Error 255

Maybe I should try to use the distribution package instead? The
compilation wasn't smooth either, it gave me some autoconf errors I eventually
solved. However, if I run this command to compile all sources, it works, prints
some patches for the drivers/ directory in the standard output, but after a
little (and before descending to drivers/staging/ directory), it gives the same
error (I will skip some output and only copy the last patch it produces):

make coccicheck MODE=patch J=8

Please check for false positives in the output before submitting a patch.
When using "patch" mode, carefully review the patch before submitting it.

... (output skipped - various patches)

diff -u -p a/drivers/s390/crypto/zcrypt_ep11misc.c b/drivers/s390/crypto/zcrypt_ep11misc.c
--- a/drivers/s390/crypto/zcrypt_ep11misc.c
+++ b/drivers/s390/crypto/zcrypt_ep11misc.c
@@ -195,11 +195,10 @@ static inline struct ep11_cprb *alloc_cp
        size_t len = sizeof(struct ep11_cprb) + payload_len;
        struct ep11_cprb *cprb;

-       cprb = kmalloc(len, GFP_KERNEL);
+       cprb = kzalloc(len, GFP_KERNEL);
        if (!cprb)
                return NULL;

-       memset(cprb, 0, len);
        cprb->cprb_len = sizeof(struct ep11_cprb);
        cprb->cprb_ver_id = 0x04;
        memcpy(cprb->func_id, "T4", 2);
coccicheck failed
Makefile:1740: recipe for target 'coccicheck' failed
make: *** [coccicheck] Error 255

Maybe I am not using the command properly? I searched how to do it and
didn't get it, sorry :(

Thank you for your help!


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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-13  9:40   ` Lourdes Pedrajas
@ 2020-03-16 14:08     ` Stefano Brivio
  2020-03-16 14:27       ` Julia Lawall
  0 siblings, 1 reply; 19+ messages in thread
From: Stefano Brivio @ 2020-03-16 14:08 UTC (permalink / raw)
  To: Lourdes Pedrajas, Julia Lawall; +Cc: outreachy-kernel

On Fri, 13 Mar 2020 10:40:46 +0100
Lourdes Pedrajas <lu@pplo.net> wrote:

> [...]
>
> Indeed, this is all the output: (this command is run in the sources root
> directory)
> 
> make coccicheck MODE=patch J=8 M=drivers/staging/android/
> 
> Please check for false positives in the output before submitting a patch.
> When using "patch" mode, carefully review the patch before submitting it.
> 
> coccicheck failed
> Makefile:1740: recipe for target 'coccicheck' failed
> make: *** [coccicheck] Error 255

Hah, I think I got the same issue on Debian. I installed coccinelle via
opam, then:

---
$ make coccicheck MODE=report M=drivers/staging/android/

Please check for false positives in the output before submitting a patch.
When using "patch" mode, carefully review the patch before submitting it.

coccicheck failed
make: *** [Makefile:1740: coccicheck] Error 255
---

Debugging: looking at makefiles, I thought about using V=1:

---
$ make V=1 coccicheck MODE=report M=drivers/staging/android/
bash ./scripts/coccicheck

Please check for false positives in the output before submitting a patch.
When using "patch" mode, carefully review the patch before submitting it.

Processing alloc_cast.cocci
with option(s) " --no-includes --include-headers"

Message example to submit a patch:
 Remove casting the values returned by memory allocation functions
 like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc.

 The semantic patch that makes this report is available
 in scripts/coccinelle/api/alloc/alloc_cast.cocci.

 More information about semantic patching is available at
 http://coccinelle.lip6.fr/

Semantic patch information:
 This makes an effort to find cases of casting of values returned by
 kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
 kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes
 the casting as it is not required. The result in the patch case may
 need some reformatting.

Running (4 in parallel): /home/sbrivio/.opam/default/bin/spatch -D report --no-show-diff --very-quiet --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes --include-headers --patch . --dir drivers/staging/android/ -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 4 --chunksize 1
coccicheck failed
make: *** [Makefile:1740: coccicheck] Error 255
---

so, yeah, spatch fails, but no error (see below) isn't propagated (even
with V=1)

Julia, do you think it's worth trying to fix this? Any quick idea?

Anyway, running the spatch command by itself:

---
$ /home/sbrivio/.opam/default/bin/spatch -D report --no-show-diff --very-quiet --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes --include-headers --patch . --dir drivers/staging/android/ -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/kconfig.h
Py.find_library: unable to find the Python library [libpython2.7m.so returned Library not found] [/usr/bin/../lib/libpython2.7m.so returned Library not found] [libpython2.7.so returned Library not found] [/usr/bin/../lib/libpython2.7.so returned Library not found]
---

I installed libpython2.7-dev, and everything works now.

-- 
Stefano



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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-16 14:08     ` Stefano Brivio
@ 2020-03-16 14:27       ` Julia Lawall
  2020-03-16 14:36         ` Stefano Brivio
  0 siblings, 1 reply; 19+ messages in thread
From: Julia Lawall @ 2020-03-16 14:27 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: Lourdes Pedrajas, outreachy-kernel



On Mon, 16 Mar 2020, Stefano Brivio wrote:

> On Fri, 13 Mar 2020 10:40:46 +0100
> Lourdes Pedrajas <lu@pplo.net> wrote:
>
> > [...]
> >
> > Indeed, this is all the output: (this command is run in the sources root
> > directory)
> >
> > make coccicheck MODE=patch J=8 M=drivers/staging/android/
> >
> > Please check for false positives in the output before submitting a patch.
> > When using "patch" mode, carefully review the patch before submitting it.
> >
> > coccicheck failed
> > Makefile:1740: recipe for target 'coccicheck' failed
> > make: *** [coccicheck] Error 255
>
> Hah, I think I got the same issue on Debian. I installed coccinelle via
> opam, then:
>
> ---
> $ make coccicheck MODE=report M=drivers/staging/android/
>
> Please check for false positives in the output before submitting a patch.
> When using "patch" mode, carefully review the patch before submitting it.
>
> coccicheck failed
> make: *** [Makefile:1740: coccicheck] Error 255
> ---
>
> Debugging: looking at makefiles, I thought about using V=1:
>
> ---
> $ make V=1 coccicheck MODE=report M=drivers/staging/android/
> bash ./scripts/coccicheck
>
> Please check for false positives in the output before submitting a patch.
> When using "patch" mode, carefully review the patch before submitting it.
>
> Processing alloc_cast.cocci
> with option(s) " --no-includes --include-headers"
>
> Message example to submit a patch:
>  Remove casting the values returned by memory allocation functions
>  like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc.
>
>  The semantic patch that makes this report is available
>  in scripts/coccinelle/api/alloc/alloc_cast.cocci.
>
>  More information about semantic patching is available at
>  http://coccinelle.lip6.fr/
>
> Semantic patch information:
>  This makes an effort to find cases of casting of values returned by
>  kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
>  kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes
>  the casting as it is not required. The result in the patch case may
>  need some reformatting.
>
> Running (4 in parallel): /home/sbrivio/.opam/default/bin/spatch -D report --no-show-diff --very-quiet --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes --include-headers --patch . --dir drivers/staging/android/ -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 4 --chunksize 1
> coccicheck failed
> make: *** [Makefile:1740: coccicheck] Error 255
> ---
>
> so, yeah, spatch fails, but no error (see below) isn't propagated (even
> with V=1)
>
> Julia, do you think it's worth trying to fix this? Any quick idea?

I will try to find the problem.  I think there is a way to get debug
information.

julia


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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-16 14:27       ` Julia Lawall
@ 2020-03-16 14:36         ` Stefano Brivio
  2020-03-16 14:44           ` Julia Lawall
  0 siblings, 1 reply; 19+ messages in thread
From: Stefano Brivio @ 2020-03-16 14:36 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Lourdes Pedrajas, outreachy-kernel

On Mon, 16 Mar 2020 15:27:38 +0100 (CET)
Julia Lawall <julia.lawall@inria.fr> wrote:

> On Mon, 16 Mar 2020, Stefano Brivio wrote:
> 
> > On Fri, 13 Mar 2020 10:40:46 +0100
> > Lourdes Pedrajas <lu@pplo.net> wrote:
> >  
> > > [...]
> > >
> > > Indeed, this is all the output: (this command is run in the sources root
> > > directory)
> > >
> > > make coccicheck MODE=patch J=8 M=drivers/staging/android/
> > >
> > > Please check for false positives in the output before submitting a patch.
> > > When using "patch" mode, carefully review the patch before submitting it.
> > >
> > > coccicheck failed
> > > Makefile:1740: recipe for target 'coccicheck' failed
> > > make: *** [coccicheck] Error 255  
> >
> > Hah, I think I got the same issue on Debian. I installed coccinelle via
> > opam, then:
> >
> > ---
> > $ make coccicheck MODE=report M=drivers/staging/android/
> >
> > Please check for false positives in the output before submitting a patch.
> > When using "patch" mode, carefully review the patch before submitting it.
> >
> > coccicheck failed
> > make: *** [Makefile:1740: coccicheck] Error 255
> > ---
> >
> > Debugging: looking at makefiles, I thought about using V=1:
> >
> > ---
> > $ make V=1 coccicheck MODE=report M=drivers/staging/android/
> > bash ./scripts/coccicheck
> >
> > Please check for false positives in the output before submitting a patch.
> > When using "patch" mode, carefully review the patch before submitting it.
> >
> > Processing alloc_cast.cocci
> > with option(s) " --no-includes --include-headers"
> >
> > Message example to submit a patch:
> >  Remove casting the values returned by memory allocation functions
> >  like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc.
> >
> >  The semantic patch that makes this report is available
> >  in scripts/coccinelle/api/alloc/alloc_cast.cocci.
> >
> >  More information about semantic patching is available at
> >  http://coccinelle.lip6.fr/
> >
> > Semantic patch information:
> >  This makes an effort to find cases of casting of values returned by
> >  kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
> >  kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes
> >  the casting as it is not required. The result in the patch case may
> >  need some reformatting.
> >
> > Running (4 in parallel): /home/sbrivio/.opam/default/bin/spatch -D report --no-show-diff --very-quiet --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes --include-headers --patch . --dir drivers/staging/android/ -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 4 --chunksize 1
> > coccicheck failed
> > make: *** [Makefile:1740: coccicheck] Error 255
> > ---
> >
> > so, yeah, spatch fails, but no error (see below) isn't propagated (even
> > with V=1)
> >
> > Julia, do you think it's worth trying to fix this? Any quick idea?  
> 
> I will try to find the problem.  I think there is a way to get debug
> information.

One idea might be, in run_cmd_parmap(), to avoid redirecting stderr
here:
	        $@ 2>>$DEBUG_FILE

if DEBUG_FILE is not set (that is, it's /dev/null) and we detect V=1 --
otherwise, spatch output is thrown away.

That works for me, but I'm not sure how elegant you would consider that.

-- 
Stefano



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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-16 14:36         ` Stefano Brivio
@ 2020-03-16 14:44           ` Julia Lawall
  2020-03-16 15:23             ` Stefano Brivio
  0 siblings, 1 reply; 19+ messages in thread
From: Julia Lawall @ 2020-03-16 14:44 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: Lourdes Pedrajas, outreachy-kernel



On Mon, 16 Mar 2020, Stefano Brivio wrote:

> On Mon, 16 Mar 2020 15:27:38 +0100 (CET)
> Julia Lawall <julia.lawall@inria.fr> wrote:
>
> > On Mon, 16 Mar 2020, Stefano Brivio wrote:
> >
> > > On Fri, 13 Mar 2020 10:40:46 +0100
> > > Lourdes Pedrajas <lu@pplo.net> wrote:
> > >
> > > > [...]
> > > >
> > > > Indeed, this is all the output: (this command is run in the sources root
> > > > directory)
> > > >
> > > > make coccicheck MODE=patch J=8 M=drivers/staging/android/
> > > >
> > > > Please check for false positives in the output before submitting a patch.
> > > > When using "patch" mode, carefully review the patch before submitting it.
> > > >
> > > > coccicheck failed
> > > > Makefile:1740: recipe for target 'coccicheck' failed
> > > > make: *** [coccicheck] Error 255
> > >
> > > Hah, I think I got the same issue on Debian. I installed coccinelle via
> > > opam, then:
> > >
> > > ---
> > > $ make coccicheck MODE=report M=drivers/staging/android/
> > >
> > > Please check for false positives in the output before submitting a patch.
> > > When using "patch" mode, carefully review the patch before submitting it.
> > >
> > > coccicheck failed
> > > make: *** [Makefile:1740: coccicheck] Error 255
> > > ---
> > >
> > > Debugging: looking at makefiles, I thought about using V=1:
> > >
> > > ---
> > > $ make V=1 coccicheck MODE=report M=drivers/staging/android/
> > > bash ./scripts/coccicheck
> > >
> > > Please check for false positives in the output before submitting a patch.
> > > When using "patch" mode, carefully review the patch before submitting it.
> > >
> > > Processing alloc_cast.cocci
> > > with option(s) " --no-includes --include-headers"
> > >
> > > Message example to submit a patch:
> > >  Remove casting the values returned by memory allocation functions
> > >  like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc.
> > >
> > >  The semantic patch that makes this report is available
> > >  in scripts/coccinelle/api/alloc/alloc_cast.cocci.
> > >
> > >  More information about semantic patching is available at
> > >  http://coccinelle.lip6.fr/
> > >
> > > Semantic patch information:
> > >  This makes an effort to find cases of casting of values returned by
> > >  kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
> > >  kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes
> > >  the casting as it is not required. The result in the patch case may
> > >  need some reformatting.
> > >
> > > Running (4 in parallel): /home/sbrivio/.opam/default/bin/spatch -D report --no-show-diff --very-quiet --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes --include-headers --patch . --dir drivers/staging/android/ -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 4 --chunksize 1
> > > coccicheck failed
> > > make: *** [Makefile:1740: coccicheck] Error 255
> > > ---
> > >
> > > so, yeah, spatch fails, but no error (see below) isn't propagated (even
> > > with V=1)
> > >
> > > Julia, do you think it's worth trying to fix this? Any quick idea?
> >
> > I will try to find the problem.  I think there is a way to get debug
> > information.
>
> One idea might be, in run_cmd_parmap(), to avoid redirecting stderr
> here:
> 	        $@ 2>>$DEBUG_FILE
>
> if DEBUG_FILE is not set (that is, it's /dev/null) and we detect V=1 --
> otherwise, spatch output is thrown away.
>
> That works for me, but I'm not sure how elegant you would consider that.

Actually, I was just going to try to fix the semantic patch that caused
the problem.  I don't really maintain make coccicheck, but I will suggest
it to the person who does.  Thanks.

julia


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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-16 14:44           ` Julia Lawall
@ 2020-03-16 15:23             ` Stefano Brivio
  2020-03-16 15:32               ` Julia Lawall
  0 siblings, 1 reply; 19+ messages in thread
From: Stefano Brivio @ 2020-03-16 15:23 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Lourdes Pedrajas, outreachy-kernel

On Mon, 16 Mar 2020 15:44:05 +0100 (CET)
Julia Lawall <julia.lawall@inria.fr> wrote:

> On Mon, 16 Mar 2020, Stefano Brivio wrote:
> 
> [...]
>
> >
> > One idea might be, in run_cmd_parmap(), to avoid redirecting stderr
> > here:
> > 	        $@ 2>>$DEBUG_FILE
> >
> > if DEBUG_FILE is not set (that is, it's /dev/null) and we detect V=1 --
> > otherwise, spatch output is thrown away.
> >
> > That works for me, but I'm not sure how elegant you would consider that.  
> 
> Actually, I was just going to try to fix the semantic patch that caused
> the problem.  I don't really maintain make coccicheck, but I will suggest
> it to the person who does.  Thanks.

Wait, was it really caused by a semantic patch on scripts/coccicheck? I
couldn't find anything like that in logs. My problem, ultimately, was
simply libpython2.7-dev missing.

-- 
Stefano



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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-16 15:23             ` Stefano Brivio
@ 2020-03-16 15:32               ` Julia Lawall
  2020-03-16 15:44                 ` Stefano Brivio
  0 siblings, 1 reply; 19+ messages in thread
From: Julia Lawall @ 2020-03-16 15:32 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: Lourdes Pedrajas, outreachy-kernel



On Mon, 16 Mar 2020, Stefano Brivio wrote:

> On Mon, 16 Mar 2020 15:44:05 +0100 (CET)
> Julia Lawall <julia.lawall@inria.fr> wrote:
>
> > On Mon, 16 Mar 2020, Stefano Brivio wrote:
> >
> > [...]
> >
> > >
> > > One idea might be, in run_cmd_parmap(), to avoid redirecting stderr
> > > here:
> > > 	        $@ 2>>$DEBUG_FILE
> > >
> > > if DEBUG_FILE is not set (that is, it's /dev/null) and we detect V=1 --
> > > otherwise, spatch output is thrown away.
> > >
> > > That works for me, but I'm not sure how elegant you would consider that.
> >
> > Actually, I was just going to try to fix the semantic patch that caused
> > the problem.  I don't really maintain make coccicheck, but I will suggest
> > it to the person who does.  Thanks.
>
> Wait, was it really caused by a semantic patch on scripts/coccicheck? I
> couldn't find anything like that in logs. My problem, ultimately, was
> simply libpython2.7-dev missing.

Ah.  Thanks for the clarification.  That is another problem that should be
fixed then.  You installed the opam version?

julia


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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-16 15:32               ` Julia Lawall
@ 2020-03-16 15:44                 ` Stefano Brivio
  2020-03-19 20:15                   ` Lourdes Pedrajas
  0 siblings, 1 reply; 19+ messages in thread
From: Stefano Brivio @ 2020-03-16 15:44 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Lourdes Pedrajas, outreachy-kernel

On Mon, 16 Mar 2020 16:32:47 +0100 (CET)
Julia Lawall <julia.lawall@inria.fr> wrote:

> On Mon, 16 Mar 2020, Stefano Brivio wrote:
> 
> > On Mon, 16 Mar 2020 15:44:05 +0100 (CET)
> > Julia Lawall <julia.lawall@inria.fr> wrote:
> >  
> > > On Mon, 16 Mar 2020, Stefano Brivio wrote:
> > >
> > > [...]
> > >  
> > > >
> > > > One idea might be, in run_cmd_parmap(), to avoid redirecting stderr
> > > > here:
> > > > 	        $@ 2>>$DEBUG_FILE
> > > >
> > > > if DEBUG_FILE is not set (that is, it's /dev/null) and we detect V=1 --
> > > > otherwise, spatch output is thrown away.
> > > >
> > > > That works for me, but I'm not sure how elegant you would consider that.  
> > >
> > > Actually, I was just going to try to fix the semantic patch that caused
> > > the problem.  I don't really maintain make coccicheck, but I will suggest
> > > it to the person who does.  Thanks.  
> >
> > Wait, was it really caused by a semantic patch on scripts/coccicheck? I
> > couldn't find anything like that in logs. My problem, ultimately, was
> > simply libpython2.7-dev missing.  
> 
> Ah.  Thanks for the clarification.  That is another problem that should be
> fixed then.  You installed the opam version?

Yes, read my previous email on this thread
(<20200316150829.370975f2@elisabeth>).

-- 
Stefano



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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-16 15:44                 ` Stefano Brivio
@ 2020-03-19 20:15                   ` Lourdes Pedrajas
  2020-03-19 20:25                     ` Julia Lawall
  2020-03-19 20:43                     ` Stefano Brivio
  0 siblings, 2 replies; 19+ messages in thread
From: Lourdes Pedrajas @ 2020-03-19 20:15 UTC (permalink / raw)
  To: Stefano Brivio, Julia Lawall; +Cc: outreachy-kernel

Julia, Stefano,

I would like to move to coccinelle instead of continue using checkpatch. So 
after the problem I explained in my last email, I have been trying various
combinations of commands and modifications in some makefiles, as Stefano
suggested. In order to see what is happening or to see why I can't use
coccinelle.

This is long, so I ask for forgiveness for that :( 

Lines preceded with $ are the commands I have run. Lines inside braces () are 
some modifications I have done that is not reflected in the console's output or 
clarifications.  The majority of the output is stripped in the sake of brevity, 
only the obvious errors are here.                                               
                                                                                
I don't know if this will be useful or not :( But I'll be glad if as least my 
problem helps to find any error or bug, or helps coccinelle itself.

Thank you,
Lourdes 


====

$ make coccicheck MODE=patch J=8 M=drivers/staging/android/ --debug

--(stripped output)
File 'coccicheck' does not exist.
Must remake target 'coccicheck'.

Please check for false positives in the output before submitting a patch.
When using "patch" mode, carefully review the patch before submitting it.

coccicheck failed
Makefile:1740: recipe for target 'coccicheck' failed
make: *** [coccicheck] Error 255

====

$ make coccicheck MODE=patch J=8 M=drivers/staging/android/ --debug

(showing $(BASH) and $(srctree) variables from 1740 line of the main Makefile,
and DIR and SPATCH from scripts/coccicheck lines 10-11)

--(stripped output)
File 'coccicheck' does not exist.
Must remake target 'coccicheck'.

Please check for false positives in the output before submitting a patch.
When using "patch" mode, carefully review the patch before submitting it.

BASH = bash
srctree = .

DIR = /mnt/btrfsimg/gregkh/staging/scripts/..
SPATCH = /usr/local/bin/spatch

coccicheck failed
Makefile:1740: recipe for target 'coccicheck' failed
make: *** [coccicheck] Error 255

====

$ make /mnt/btrfsimg/gregkh/staging/scripts/coccicheck MODE=patch J=8
  M=drivers/staging/android/ --debug

(but x86_64 binutils are installed!! It don't repeat the error of last command
about not finding coccicheck file here)

--(stripped output)

arch/x86/Makefile:147: CONFIG_X86_X32 enabled but no binutils support

====

$ make /mnt/btrfsimg/gregkh/staging/scripts/coccicheck MODE=patch J=8
  M=drivers/staging/android/ --debug

(w/o CONFIG_X86_X32 or commenting-out the ifdef CONFIG_X86_X32 section of
arch/x86/Makefile)

--(stripped output)

make: Nothing to be done for '/mnt/btrfsimg/gregkh/staging/scripts/coccicheck'.

====

$ make coccicheck C=2 MODE=patch J=8 drivers/staging/android/ashmem.c --debug

--(stripped output)
File 'coccicheck' does not exist.
Must remake target 'coccicheck'.
./scripts/coccicheck: line 65: shift: -1: shift count out of range
Successfully remade target file 'coccicheck'.
make: Nothing to be done for 'drivers/staging/android/ashmem.c'.

====

$ make coccicheck C=2 MODE=patch J=8 --debug drivers/staging/*/*.c

--(stripped output)
File 'coccicheck' does not exist.
Must remake target 'coccicheck'.
./scripts/coccicheck: line 65: shift: -1: shift count out of range
Successfully remade target file 'coccicheck'.
make: Nothing to be done for 'drivers/staging/android/ashmem.c'.
make: Nothing to be done for 'drivers/staging/axis-fifo/axis-fifo.c'.
--(stripped output: it repeats the same line for all C files inside staging
   drivers)

====

$ make coccicheck C=1 MODE=patch J=8 --debug drivers/staging/*/*.c

--(stripped output)
File 'coccicheck' does not exist.
Must remake target 'coccicheck'.
./scripts/coccicheck: line 65: shift: -1: shift count out of range
Successfully remade target file 'coccicheck'.
make: Nothing to be done for 'drivers/staging/android/ashmem.c'.
make: Nothing to be done for 'drivers/staging/axis-fifo/axis-fifo.c'.
--(stripped output: it repeats the same line for all C files inside staging
   drivers)

====

$ make coccicheck MODE=patch J=8 drivers/staging/android/ --debug

Reading makefiles...
Updating goal targets....
 File 'coccicheck' does not exist.
   File '__build_one_by_one' does not exist.
  Must remake target '__build_one_by_one'.
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets....
 File 'coccicheck' does not exist.
Must remake target 'coccicheck'.

--(stripped output: after a while it produces some patches in drivers/ but not
   drivers/staging/. And then the same error:)

coccicheck failed
Makefile:1740: recipe for target 'coccicheck' failed
make: *** [coccicheck] Error 255

====

$ make coccicheck MODE=patch V=1 J=8 --debug

(it works, but doesn't descend into drivers/staging/ before giving this error:)

coccicheck failed
Makefile:1740: recipe for target 'coccicheck' failed
make: *** [coccicheck] Error 255

====

$ make coccicheck MODE=patch V=1 J=8 --debug
(with variable KBUILD_EXTMOD set to drivers/staging/ in scripts/coccicheck)

--(stripped output)
File 'coccicheck' does not exist.
Must remake target 'coccicheck'.
bash ./scripts/coccicheck
--(stripped output)

Processing alloc_cast.cocci
with option(s) " --no-includes --include-headers"

--(stripped output)

Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
--cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes
--include-headers --patch . --dir ./drivers/staging/. -I ./arch/x86/include
-I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi
-I ./arch/x86/include/generated/uapi -I ./include/uapi
-I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 8
--chunksize 1
Processing pool_zalloc-simple.cocci
with option(s) " --no-includes --include-headers"

--(stripped output)

Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
--cocci-file ./scripts/coccinelle/api/alloc/pool_zalloc-simple.cocci
--no-includes --include-headers --patch . --dir ./drivers/staging/.
-I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
-I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
-I ./include/uapi -I ./include/generated/uapi
--include ./include/linux/kconfig.h --jobs 8 --chunksize 1
Processing zalloc-simple.cocci
with option(s) " --no-includes --include-headers

--(stripped output)

Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
--cocci-file ./scripts/coccinelle/api/alloc/zalloc-simple.cocci
--no-includes --include-headers --patch . --dir ./drivers/staging/.
-I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
-I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
-I ./include/uapi -I ./include/generated/uapi
--include ./include/linux/kconfig.h --jobs 8 --chunksize 1
Processing atomic_as_refcounter.cocci
with option(s) " --include-headers --very-quiet"

--(stripped output)

Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
--cocci-file ./scripts/coccinelle/api/atomic_as_refcounter.cocci
--include-headers --very-quiet --patch . --dir ./drivers/staging/.
-I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
-I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
-I ./include/uapi -I ./include/generated/uapi
--include ./include/linux/kconfig.h --jobs 8 --chunksize 1
coccicheck failed
Makefile:1740: recipe for target 'coccicheck' failed
make: *** [coccicheck] Error 255


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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-19 20:15                   ` Lourdes Pedrajas
@ 2020-03-19 20:25                     ` Julia Lawall
  2020-03-19 20:43                     ` Stefano Brivio
  1 sibling, 0 replies; 19+ messages in thread
From: Julia Lawall @ 2020-03-19 20:25 UTC (permalink / raw)
  To: Lourdes Pedrajas; +Cc: Stefano Brivio, outreachy-kernel



On Thu, 19 Mar 2020, Lourdes Pedrajas wrote:

> Julia, Stefano,
>
> I would like to move to coccinelle instead of continue using checkpatch. So
> after the problem I explained in my last email, I have been trying various
> combinations of commands and modifications in some makefiles, as Stefano
> suggested. In order to see what is happening or to see why I can't use
> coccinelle.
>
> This is long, so I ask for forgiveness for that :(
>
> Lines preceded with $ are the commands I have run. Lines inside braces () are
> some modifications I have done that is not reflected in the console's output or
> clarifications.  The majority of the output is stripped in the sake of brevity,
> only the obvious errors are here.
>
> I don't know if this will be useful or not :( But I'll be glad if as least my
> problem helps to find any error or bug, or helps coccinelle itself.

Hi,

I would suggest to drop make coccicheck for the moment and just run
coccinelle directly.

Just go to your kernel directory and pick any *cocci file below
scripts/coccinelle.  Then run spatch -D report file.cocci .
(the . is to refer to the current directory, not the end of the sentence).
Hopefully, this way you will see what the problem is.

When you can get one rule to run properly, even if it doesn't find
anything, then you should be able to run make coccicheck with no problem.

julia




>
> Thank you,
> Lourdes
>
>
> ====
>
> $ make coccicheck MODE=patch J=8 M=drivers/staging/android/ --debug
>
> --(stripped output)
> File 'coccicheck' does not exist.
> Must remake target 'coccicheck'.
>
> Please check for false positives in the output before submitting a patch.
> When using "patch" mode, carefully review the patch before submitting it.
>
> coccicheck failed
> Makefile:1740: recipe for target 'coccicheck' failed
> make: *** [coccicheck] Error 255
>
> ====
>
> $ make coccicheck MODE=patch J=8 M=drivers/staging/android/ --debug
>
> (showing $(BASH) and $(srctree) variables from 1740 line of the main Makefile,
> and DIR and SPATCH from scripts/coccicheck lines 10-11)
>
> --(stripped output)
> File 'coccicheck' does not exist.
> Must remake target 'coccicheck'.
>
> Please check for false positives in the output before submitting a patch.
> When using "patch" mode, carefully review the patch before submitting it.
>
> BASH = bash
> srctree = .
>
> DIR = /mnt/btrfsimg/gregkh/staging/scripts/..
> SPATCH = /usr/local/bin/spatch
>
> coccicheck failed
> Makefile:1740: recipe for target 'coccicheck' failed
> make: *** [coccicheck] Error 255
>
> ====
>
> $ make /mnt/btrfsimg/gregkh/staging/scripts/coccicheck MODE=patch J=8
>   M=drivers/staging/android/ --debug
>
> (but x86_64 binutils are installed!! It don't repeat the error of last command
> about not finding coccicheck file here)
>
> --(stripped output)
>
> arch/x86/Makefile:147: CONFIG_X86_X32 enabled but no binutils support
>
> ====
>
> $ make /mnt/btrfsimg/gregkh/staging/scripts/coccicheck MODE=patch J=8
>   M=drivers/staging/android/ --debug
>
> (w/o CONFIG_X86_X32 or commenting-out the ifdef CONFIG_X86_X32 section of
> arch/x86/Makefile)
>
> --(stripped output)
>
> make: Nothing to be done for '/mnt/btrfsimg/gregkh/staging/scripts/coccicheck'.
>
> ====
>
> $ make coccicheck C=2 MODE=patch J=8 drivers/staging/android/ashmem.c --debug
>
> --(stripped output)
> File 'coccicheck' does not exist.
> Must remake target 'coccicheck'.
> ./scripts/coccicheck: line 65: shift: -1: shift count out of range
> Successfully remade target file 'coccicheck'.
> make: Nothing to be done for 'drivers/staging/android/ashmem.c'.
>
> ====
>
> $ make coccicheck C=2 MODE=patch J=8 --debug drivers/staging/*/*.c
>
> --(stripped output)
> File 'coccicheck' does not exist.
> Must remake target 'coccicheck'.
> ./scripts/coccicheck: line 65: shift: -1: shift count out of range
> Successfully remade target file 'coccicheck'.
> make: Nothing to be done for 'drivers/staging/android/ashmem.c'.
> make: Nothing to be done for 'drivers/staging/axis-fifo/axis-fifo.c'.
> --(stripped output: it repeats the same line for all C files inside staging
>    drivers)
>
> ====
>
> $ make coccicheck C=1 MODE=patch J=8 --debug drivers/staging/*/*.c
>
> --(stripped output)
> File 'coccicheck' does not exist.
> Must remake target 'coccicheck'.
> ./scripts/coccicheck: line 65: shift: -1: shift count out of range
> Successfully remade target file 'coccicheck'.
> make: Nothing to be done for 'drivers/staging/android/ashmem.c'.
> make: Nothing to be done for 'drivers/staging/axis-fifo/axis-fifo.c'.
> --(stripped output: it repeats the same line for all C files inside staging
>    drivers)
>
> ====
>
> $ make coccicheck MODE=patch J=8 drivers/staging/android/ --debug
>
> Reading makefiles...
> Updating goal targets....
>  File 'coccicheck' does not exist.
>    File '__build_one_by_one' does not exist.
>   Must remake target '__build_one_by_one'.
> GNU Make 4.1
> Built for x86_64-pc-linux-gnu
> Copyright (C) 1988-2014 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Reading makefiles...
> Updating goal targets....
>  File 'coccicheck' does not exist.
> Must remake target 'coccicheck'.
>
> --(stripped output: after a while it produces some patches in drivers/ but not
>    drivers/staging/. And then the same error:)
>
> coccicheck failed
> Makefile:1740: recipe for target 'coccicheck' failed
> make: *** [coccicheck] Error 255
>
> ====
>
> $ make coccicheck MODE=patch V=1 J=8 --debug
>
> (it works, but doesn't descend into drivers/staging/ before giving this error:)
>
> coccicheck failed
> Makefile:1740: recipe for target 'coccicheck' failed
> make: *** [coccicheck] Error 255
>
> ====
>
> $ make coccicheck MODE=patch V=1 J=8 --debug
> (with variable KBUILD_EXTMOD set to drivers/staging/ in scripts/coccicheck)
>
> --(stripped output)
> File 'coccicheck' does not exist.
> Must remake target 'coccicheck'.
> bash ./scripts/coccicheck
> --(stripped output)
>
> Processing alloc_cast.cocci
> with option(s) " --no-includes --include-headers"
>
> --(stripped output)
>
> Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
> --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes
> --include-headers --patch . --dir ./drivers/staging/. -I ./arch/x86/include
> -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi
> -I ./arch/x86/include/generated/uapi -I ./include/uapi
> -I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 8
> --chunksize 1
> Processing pool_zalloc-simple.cocci
> with option(s) " --no-includes --include-headers"
>
> --(stripped output)
>
> Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
> --cocci-file ./scripts/coccinelle/api/alloc/pool_zalloc-simple.cocci
> --no-includes --include-headers --patch . --dir ./drivers/staging/.
> -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
> -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
> -I ./include/uapi -I ./include/generated/uapi
> --include ./include/linux/kconfig.h --jobs 8 --chunksize 1
> Processing zalloc-simple.cocci
> with option(s) " --no-includes --include-headers
>
> --(stripped output)
>
> Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
> --cocci-file ./scripts/coccinelle/api/alloc/zalloc-simple.cocci
> --no-includes --include-headers --patch . --dir ./drivers/staging/.
> -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
> -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
> -I ./include/uapi -I ./include/generated/uapi
> --include ./include/linux/kconfig.h --jobs 8 --chunksize 1
> Processing atomic_as_refcounter.cocci
> with option(s) " --include-headers --very-quiet"
>
> --(stripped output)
>
> Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
> --cocci-file ./scripts/coccinelle/api/atomic_as_refcounter.cocci
> --include-headers --very-quiet --patch . --dir ./drivers/staging/.
> -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
> -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
> -I ./include/uapi -I ./include/generated/uapi
> --include ./include/linux/kconfig.h --jobs 8 --chunksize 1
> coccicheck failed
> Makefile:1740: recipe for target 'coccicheck' failed
> make: *** [coccicheck] Error 255
>


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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-19 20:15                   ` Lourdes Pedrajas
  2020-03-19 20:25                     ` Julia Lawall
@ 2020-03-19 20:43                     ` Stefano Brivio
  2020-03-19 21:30                       ` Lourdes Pedrajas
  1 sibling, 1 reply; 19+ messages in thread
From: Stefano Brivio @ 2020-03-19 20:43 UTC (permalink / raw)
  To: Lourdes Pedrajas; +Cc: Julia Lawall, outreachy-kernel

On Thu, 19 Mar 2020 21:15:53 +0100
Lourdes Pedrajas <lu@pplo.net> wrote:

Can you just run this spatch command:

> Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
> --cocci-file ./scripts/coccinelle/api/atomic_as_refcounter.cocci
> --include-headers --very-quiet --patch . --dir ./drivers/staging/.
> -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
> -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
> -I ./include/uapi -I ./include/generated/uapi
> --include ./include/linux/kconfig.h --jobs 8 --chunksize 1
> coccicheck failed
> Makefile:1740: recipe for target 'coccicheck' failed
> make: *** [coccicheck] Error 255

alone, from the same directory? The issue (okay, I'll send a patch) is
that the coccicheck script suppresses stderr for it.

-- 
Stefano



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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-19 20:43                     ` Stefano Brivio
@ 2020-03-19 21:30                       ` Lourdes Pedrajas
  2020-03-19 21:38                         ` Julia Lawall
  0 siblings, 1 reply; 19+ messages in thread
From: Lourdes Pedrajas @ 2020-03-19 21:30 UTC (permalink / raw)
  To: Stefano Brivio, Julia Lawall; +Cc: outreachy-kernel

On Thu, Mar 19, 2020 at 09:43:21PM +0100, Stefano Brivio wrote:
> On Thu, 19 Mar 2020 21:15:53 +0100
> Lourdes Pedrajas <lu@pplo.net> wrote:
> 
> Can you just run this spatch command:
> 
> > Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
> > --cocci-file ./scripts/coccinelle/api/atomic_as_refcounter.cocci
> > --include-headers --very-quiet --patch . --dir ./drivers/staging/.
> > -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
> > -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
> > -I ./include/uapi -I ./include/generated/uapi
> > --include ./include/linux/kconfig.h --jobs 8 --chunksize 1
> > coccicheck failed
> > Makefile:1740: recipe for target 'coccicheck' failed
> > make: *** [coccicheck] Error 255
> 
> alone, from the same directory? The issue (okay, I'll send a patch) is
> that the coccicheck script suppresses stderr for it.
> 
> -- 
> Stefano
> 

It says "274 files match" and if I suppress the "--very-quiet" part of
the command, it outputs many files preceded with the word "HANDLING:".

After that, If I try, by example, this command:

/usr/local/bin/spatch -D patch
--cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci
--no-includes --include-headers -I ./arch/x86/include
-I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi
-I ./arch/x86/include/generated/uapi -I ./include/uapi
-I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 8
--chunksize 1 drivers/staging/qlge/qlge_mpi.c

It says:

HANDLING: drivers/staging/qlge/qlge_mpi.c

But nothing more.

The command Julia suggest has similar results.

Is this correct? I thought it outputs reports or patches.

Thank you,
Lourdes


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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-19 21:30                       ` Lourdes Pedrajas
@ 2020-03-19 21:38                         ` Julia Lawall
  2020-03-19 21:47                           ` Lourdes Pedrajas
  0 siblings, 1 reply; 19+ messages in thread
From: Julia Lawall @ 2020-03-19 21:38 UTC (permalink / raw)
  To: Lourdes Pedrajas; +Cc: Stefano Brivio, outreachy-kernel



On Thu, 19 Mar 2020, Lourdes Pedrajas wrote:

> On Thu, Mar 19, 2020 at 09:43:21PM +0100, Stefano Brivio wrote:
> > On Thu, 19 Mar 2020 21:15:53 +0100
> > Lourdes Pedrajas <lu@pplo.net> wrote:
> >
> > Can you just run this spatch command:
> >
> > > Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
> > > --cocci-file ./scripts/coccinelle/api/atomic_as_refcounter.cocci
> > > --include-headers --very-quiet --patch . --dir ./drivers/staging/.
> > > -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
> > > -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
> > > -I ./include/uapi -I ./include/generated/uapi
> > > --include ./include/linux/kconfig.h --jobs 8 --chunksize 1
> > > coccicheck failed
> > > Makefile:1740: recipe for target 'coccicheck' failed
> > > make: *** [coccicheck] Error 255
> >
> > alone, from the same directory? The issue (okay, I'll send a patch) is
> > that the coccicheck script suppresses stderr for it.
> >
> > --
> > Stefano
> >
>
> It says "274 files match" and if I suppress the "--very-quiet" part of
> the command, it outputs many files preceded with the word "HANDLING:".
>
> After that, If I try, by example, this command:
>
> /usr/local/bin/spatch -D patch
> --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci
> --no-includes --include-headers -I ./arch/x86/include
> -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi
> -I ./arch/x86/include/generated/uapi -I ./include/uapi
> -I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 8
> --chunksize 1 drivers/staging/qlge/qlge_mpi.c
>
> It says:
>
> HANDLING: drivers/staging/qlge/qlge_mpi.c
>
> But nothing more.
>
> The command Julia suggest has similar results.
>
> Is this correct? I thought it outputs reports or patches.

Yes, that is correct.  Maybe it has nothing to do on that file.

Could you try the following file:

drivers/net/ethernet/qlogic/qed/qed_roce.c

with the semantic patch

scripts/coccinelle/api/alloc/alloc_cast.cocci

julia


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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-19 21:38                         ` Julia Lawall
@ 2020-03-19 21:47                           ` Lourdes Pedrajas
  2020-03-19 21:50                             ` Julia Lawall
  0 siblings, 1 reply; 19+ messages in thread
From: Lourdes Pedrajas @ 2020-03-19 21:47 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Stefano Brivio, outreachy-kernel

On Thu, Mar 19, 2020 at 10:38:59PM +0100, Julia Lawall wrote:
> 
> 
> On Thu, 19 Mar 2020, Lourdes Pedrajas wrote:
> 
> > On Thu, Mar 19, 2020 at 09:43:21PM +0100, Stefano Brivio wrote:
> > > On Thu, 19 Mar 2020 21:15:53 +0100
> > > Lourdes Pedrajas <lu@pplo.net> wrote:
> > >
> > > Can you just run this spatch command:
> > >
> > > > Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
> > > > --cocci-file ./scripts/coccinelle/api/atomic_as_refcounter.cocci
> > > > --include-headers --very-quiet --patch . --dir ./drivers/staging/.
> > > > -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
> > > > -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
> > > > -I ./include/uapi -I ./include/generated/uapi
> > > > --include ./include/linux/kconfig.h --jobs 8 --chunksize 1
> > > > coccicheck failed
> > > > Makefile:1740: recipe for target 'coccicheck' failed
> > > > make: *** [coccicheck] Error 255
> > >
> > > alone, from the same directory? The issue (okay, I'll send a patch) is
> > > that the coccicheck script suppresses stderr for it.
> > >
> > > --
> > > Stefano
> > >
> >
> > It says "274 files match" and if I suppress the "--very-quiet" part of
> > the command, it outputs many files preceded with the word "HANDLING:".
> >
> > After that, If I try, by example, this command:
> >
> > /usr/local/bin/spatch -D patch
> > --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci
> > --no-includes --include-headers -I ./arch/x86/include
> > -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi
> > -I ./arch/x86/include/generated/uapi -I ./include/uapi
> > -I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 8
> > --chunksize 1 drivers/staging/qlge/qlge_mpi.c
> >
> > It says:
> >
> > HANDLING: drivers/staging/qlge/qlge_mpi.c
> >
> > But nothing more.
> >
> > The command Julia suggest has similar results.
> >
> > Is this correct? I thought it outputs reports or patches.
> 
> Yes, that is correct.  Maybe it has nothing to do on that file.
> 
> Could you try the following file:
> 
> drivers/net/ethernet/qlogic/qed/qed_roce.c
> 
> with the semantic patch
> 
> scripts/coccinelle/api/alloc/alloc_cast.cocci
> 
> julia

Yes, now it worked! :) 

Thank you Julia,

Lourdes


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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-19 21:47                           ` Lourdes Pedrajas
@ 2020-03-19 21:50                             ` Julia Lawall
  2020-03-19 22:06                               ` Lourdes Pedrajas
  0 siblings, 1 reply; 19+ messages in thread
From: Julia Lawall @ 2020-03-19 21:50 UTC (permalink / raw)
  To: Lourdes Pedrajas; +Cc: Stefano Brivio, outreachy-kernel



On Thu, 19 Mar 2020, Lourdes Pedrajas wrote:

> On Thu, Mar 19, 2020 at 10:38:59PM +0100, Julia Lawall wrote:
> >
> >
> > On Thu, 19 Mar 2020, Lourdes Pedrajas wrote:
> >
> > > On Thu, Mar 19, 2020 at 09:43:21PM +0100, Stefano Brivio wrote:
> > > > On Thu, 19 Mar 2020 21:15:53 +0100
> > > > Lourdes Pedrajas <lu@pplo.net> wrote:
> > > >
> > > > Can you just run this spatch command:
> > > >
> > > > > Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
> > > > > --cocci-file ./scripts/coccinelle/api/atomic_as_refcounter.cocci
> > > > > --include-headers --very-quiet --patch . --dir ./drivers/staging/.
> > > > > -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
> > > > > -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
> > > > > -I ./include/uapi -I ./include/generated/uapi
> > > > > --include ./include/linux/kconfig.h --jobs 8 --chunksize 1
> > > > > coccicheck failed
> > > > > Makefile:1740: recipe for target 'coccicheck' failed
> > > > > make: *** [coccicheck] Error 255
> > > >
> > > > alone, from the same directory? The issue (okay, I'll send a patch) is
> > > > that the coccicheck script suppresses stderr for it.
> > > >
> > > > --
> > > > Stefano
> > > >
> > >
> > > It says "274 files match" and if I suppress the "--very-quiet" part of
> > > the command, it outputs many files preceded with the word "HANDLING:".
> > >
> > > After that, If I try, by example, this command:
> > >
> > > /usr/local/bin/spatch -D patch
> > > --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci
> > > --no-includes --include-headers -I ./arch/x86/include
> > > -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi
> > > -I ./arch/x86/include/generated/uapi -I ./include/uapi
> > > -I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 8
> > > --chunksize 1 drivers/staging/qlge/qlge_mpi.c
> > >
> > > It says:
> > >
> > > HANDLING: drivers/staging/qlge/qlge_mpi.c
> > >
> > > But nothing more.
> > >
> > > The command Julia suggest has similar results.
> > >
> > > Is this correct? I thought it outputs reports or patches.
> >
> > Yes, that is correct.  Maybe it has nothing to do on that file.
> >
> > Could you try the following file:
> >
> > drivers/net/ethernet/qlogic/qed/qed_roce.c
> >
> > with the semantic patch
> >
> > scripts/coccinelle/api/alloc/alloc_cast.cocci
> >
> > julia
>
> Yes, now it worked! :)

Um, now what worked?  I guess you got a message for this file, but is make
coccicheck now working too?

julia


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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-19 21:50                             ` Julia Lawall
@ 2020-03-19 22:06                               ` Lourdes Pedrajas
  2020-03-23  0:00                                 ` Stefano Brivio
  0 siblings, 1 reply; 19+ messages in thread
From: Lourdes Pedrajas @ 2020-03-19 22:06 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Stefano Brivio, outreachy-kernel

On Thu, Mar 19, 2020 at 10:50:15PM +0100, Julia Lawall wrote:
> 
> 
> On Thu, 19 Mar 2020, Lourdes Pedrajas wrote:
> 
> > On Thu, Mar 19, 2020 at 10:38:59PM +0100, Julia Lawall wrote:
> > >
> > >
> > > On Thu, 19 Mar 2020, Lourdes Pedrajas wrote:
> > >
> > > > On Thu, Mar 19, 2020 at 09:43:21PM +0100, Stefano Brivio wrote:
> > > > > On Thu, 19 Mar 2020 21:15:53 +0100
> > > > > Lourdes Pedrajas <lu@pplo.net> wrote:
> > > > >
> > > > > Can you just run this spatch command:
> > > > >
> > > > > > Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
> > > > > > --cocci-file ./scripts/coccinelle/api/atomic_as_refcounter.cocci
> > > > > > --include-headers --very-quiet --patch . --dir ./drivers/staging/.
> > > > > > -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
> > > > > > -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
> > > > > > -I ./include/uapi -I ./include/generated/uapi
> > > > > > --include ./include/linux/kconfig.h --jobs 8 --chunksize 1
> > > > > > coccicheck failed
> > > > > > Makefile:1740: recipe for target 'coccicheck' failed
> > > > > > make: *** [coccicheck] Error 255
> > > > >
> > > > > alone, from the same directory? The issue (okay, I'll send a patch) is
> > > > > that the coccicheck script suppresses stderr for it.
> > > > >
> > > > > --
> > > > > Stefano
> > > > >
> > > >
> > > > It says "274 files match" and if I suppress the "--very-quiet" part of
> > > > the command, it outputs many files preceded with the word "HANDLING:".
> > > >
> > > > After that, If I try, by example, this command:
> > > >
> > > > /usr/local/bin/spatch -D patch
> > > > --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci
> > > > --no-includes --include-headers -I ./arch/x86/include
> > > > -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi
> > > > -I ./arch/x86/include/generated/uapi -I ./include/uapi
> > > > -I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 8
> > > > --chunksize 1 drivers/staging/qlge/qlge_mpi.c
> > > >
> > > > It says:
> > > >
> > > > HANDLING: drivers/staging/qlge/qlge_mpi.c
> > > >
> > > > But nothing more.
> > > >
> > > > The command Julia suggest has similar results.
> > > >
> > > > Is this correct? I thought it outputs reports or patches.
> > >
> > > Yes, that is correct.  Maybe it has nothing to do on that file.
> > >
> > > Could you try the following file:
> > >
> > > drivers/net/ethernet/qlogic/qed/qed_roce.c
> > >
> > > with the semantic patch
> > >
> > > scripts/coccinelle/api/alloc/alloc_cast.cocci
> > >
> > > julia
> >
> > Yes, now it worked! :)
> 
> Um, now what worked?  I guess you got a message for this file, but is make
> coccicheck now working too?
> 
> julia

Oh, sorry I was not clear, this command worked:

/usr/local/bin/spatch -D report
--cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes
--include-headers -I ./arch/x86/include -I ./arch/x86/include/generated
-I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
-I ./include/uapi -I ./include/generated/uapi
--include ./include/linux/kconfig.h --jobs 8
--chunksize 1 drivers/net/ethernet/qlogic/qed/qed_roce.c

You were right, it had nothing to do in the file I tried (and some others too)
but in this file worked:

drivers/net/ethernet/qlogic/qed/qed_roce.c


> but is make coccicheck now working too?

No, it is not working, sorry :(

For the record, I'm using linux mint, installed the dependencies the
official site says for ubuntu/debian, but got some compilation errors
and eventually solved them. 

Thank you for your patience,

Lourdes


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

* Re: [Outreachy kernel] Trying to use Coccinelle
  2020-03-19 22:06                               ` Lourdes Pedrajas
@ 2020-03-23  0:00                                 ` Stefano Brivio
  0 siblings, 0 replies; 19+ messages in thread
From: Stefano Brivio @ 2020-03-23  0:00 UTC (permalink / raw)
  To: Lourdes Pedrajas; +Cc: Julia Lawall, outreachy-kernel

On Thu, 19 Mar 2020 23:06:05 +0100
Lourdes Pedrajas <lu@pplo.net> wrote:

> On Thu, Mar 19, 2020 at 10:50:15PM +0100, Julia Lawall wrote:
> > 
> > 
> > On Thu, 19 Mar 2020, Lourdes Pedrajas wrote:
> >   
> > > On Thu, Mar 19, 2020 at 10:38:59PM +0100, Julia Lawall wrote:  
> > > >
> > > >
> > > > On Thu, 19 Mar 2020, Lourdes Pedrajas wrote:
> > > >  
> > > > > On Thu, Mar 19, 2020 at 09:43:21PM +0100, Stefano Brivio wrote:  
> > > > > > On Thu, 19 Mar 2020 21:15:53 +0100
> > > > > > Lourdes Pedrajas <lu@pplo.net> wrote:
> > > > > >
> > > > > > Can you just run this spatch command:
> > > > > >  
> > > > > > > Running (8 in parallel): /usr/local/bin/spatch -D patch --very-quiet
> > > > > > > --cocci-file ./scripts/coccinelle/api/atomic_as_refcounter.cocci
> > > > > > > --include-headers --very-quiet --patch . --dir ./drivers/staging/.
> > > > > > > -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
> > > > > > > -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
> > > > > > > -I ./include/uapi -I ./include/generated/uapi
> > > > > > > --include ./include/linux/kconfig.h --jobs 8 --chunksize 1
> > > > > > > coccicheck failed
> > > > > > > Makefile:1740: recipe for target 'coccicheck' failed
> > > > > > > make: *** [coccicheck] Error 255  
> > > > > >
> > > > > > alone, from the same directory? The issue (okay, I'll send a patch) is
> > > > > > that the coccicheck script suppresses stderr for it.
> > > > > >
> > > > > > --
> > > > > > Stefano
> > > > > >  
> > > > >
> > > > > It says "274 files match" and if I suppress the "--very-quiet" part of
> > > > > the command, it outputs many files preceded with the word "HANDLING:".
> > > > >
> > > > > After that, If I try, by example, this command:
> > > > >
> > > > > /usr/local/bin/spatch -D patch
> > > > > --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci
> > > > > --no-includes --include-headers -I ./arch/x86/include
> > > > > -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi
> > > > > -I ./arch/x86/include/generated/uapi -I ./include/uapi
> > > > > -I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 8
> > > > > --chunksize 1 drivers/staging/qlge/qlge_mpi.c
> > > > >
> > > > > It says:
> > > > >
> > > > > HANDLING: drivers/staging/qlge/qlge_mpi.c
> > > > >
> > > > > But nothing more.
> > > > >
> > > > > The command Julia suggest has similar results.
> > > > >
> > > > > Is this correct? I thought it outputs reports or patches.  
> > > >
> > > > Yes, that is correct.  Maybe it has nothing to do on that file.
> > > >
> > > > Could you try the following file:
> > > >
> > > > drivers/net/ethernet/qlogic/qed/qed_roce.c
> > > >
> > > > with the semantic patch
> > > >
> > > > scripts/coccinelle/api/alloc/alloc_cast.cocci
> > > >
> > > > julia  
> > >
> > > Yes, now it worked! :)  
> > 
> > Um, now what worked?  I guess you got a message for this file, but is make
> > coccicheck now working too?
> > 
> > julia  
> 
> Oh, sorry I was not clear, this command worked:
> 
> /usr/local/bin/spatch -D report
> --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes
> --include-headers -I ./arch/x86/include -I ./arch/x86/include/generated
> -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
> -I ./include/uapi -I ./include/generated/uapi
> --include ./include/linux/kconfig.h --jobs 8
> --chunksize 1 drivers/net/ethernet/qlogic/qed/qed_roce.c
> 
> You were right, it had nothing to do in the file I tried (and some others too)
> but in this file worked:
> 
> drivers/net/ethernet/qlogic/qed/qed_roce.c
> 
> > but is make coccicheck now working too?  
> 
> No, it is not working, sorry :(

What if you try the spatch command (without --quiet or similar) that
gets printed by 'make coccicheck' when it actually fails?

I'm asking because the only way an issue could be hidden like this
seems to be if it's spatch failing.

-- 
Stefano



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

end of thread, other threads:[~2020-03-23  0:00 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 18:11 Trying to use Coccinelle Lourdes Pedrajas
2020-03-11 23:23 ` [Outreachy kernel] " Stefano Brivio
2020-03-13  9:40   ` Lourdes Pedrajas
2020-03-16 14:08     ` Stefano Brivio
2020-03-16 14:27       ` Julia Lawall
2020-03-16 14:36         ` Stefano Brivio
2020-03-16 14:44           ` Julia Lawall
2020-03-16 15:23             ` Stefano Brivio
2020-03-16 15:32               ` Julia Lawall
2020-03-16 15:44                 ` Stefano Brivio
2020-03-19 20:15                   ` Lourdes Pedrajas
2020-03-19 20:25                     ` Julia Lawall
2020-03-19 20:43                     ` Stefano Brivio
2020-03-19 21:30                       ` Lourdes Pedrajas
2020-03-19 21:38                         ` Julia Lawall
2020-03-19 21:47                           ` Lourdes Pedrajas
2020-03-19 21:50                             ` Julia Lawall
2020-03-19 22:06                               ` Lourdes Pedrajas
2020-03-23  0:00                                 ` Stefano Brivio

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.