Skip to contentSkip to conversation

Trying to use Coccinelle

DISCUSSION Lourdes Pedrajas 3 participants 19 messages Mar 11, 2020 – Mar 23, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 15 lines · On Wed, 11 Mar 2020 19:11:34 +0100 Lourdes Pedrajas <[email protected]> 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.

Quoted 6 lines

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?

Signature · 1 line
Stefano
#2 lore raw
Quoted 18 lines · Stefano Brivio
Quoted 15 lines · On Wed, 11 Mar 2020 19:11:34 +0100 Lourdes Pedrajas <[email protected]> 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.

Quoted 12 lines
Quoted 6 lines

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?

Signature · 1 line
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)

drivers/s390/crypto/zcrypt_ep11misc.c +1 -2
diff -u -p 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!

#3 lore raw
Quoted 5 lines · On Fri, 13 Mar 2020 10:40:46 +0100 Lourdes Pedrajas <[email protected]> wrote:

[...]

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

Quoted 8 lines

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.

Signature · 1 line
Stefano
#4 lore raw
Quoted 64 lines · Stefano Brivio
Quoted 5 lines · On Fri, 13 Mar 2020 10:40:46 +0100 Lourdes Pedrajas <[email protected]> wrote:

[...]

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

Quoted 8 lines

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
---

Quoted 4 lines

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

#5 lore raw
Quoted 66 lines · On Mon, 16 Mar 2020 15:27:38 +0100 (CET) Julia Lawall <[email protected]>…
Quoted 64 lines · Stefano Brivio
Quoted 5 lines · On Fri, 13 Mar 2020 10:40:46 +0100 Lourdes Pedrajas <[email protected]> wrote:

[...]

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

Quoted 8 lines

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
---

Quoted 7 lines
Quoted 4 lines

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.

Signature · 1 line
Stefano
#6 lore raw
Quoted 77 lines · Stefano Brivio
Quoted 66 lines · On Mon, 16 Mar 2020 15:27:38 +0100 (CET) Julia Lawall <[email protected]>…
Quoted 64 lines · Stefano Brivio
Quoted 5 lines · On Fri, 13 Mar 2020 10:40:46 +0100 Lourdes Pedrajas <[email protected]> wrote:

[...]

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

Quoted 8 lines

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
---

Quoted 7 lines
Quoted 4 lines

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.

Quoted 8 lines

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

#7 lore raw
Quoted 9 lines · On Mon, 16 Mar 2020 15:44:05 +0100 (CET) Julia Lawall <[email protected]>…

On Mon, 16 Mar 2020, Stefano Brivio wrote:

[...]

Quoted 5 lines

One idea might be, in run_cmd_parmap(), to avoid redirecting stderr here:

	        $@ 2>>$DEBUG_FILE
Quoted 8 lines
Quoted 4 lines

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.

Signature · 1 line
Stefano
#8 lore raw
Quoted 17 lines · Stefano Brivio
Quoted 14 lines · On Mon, 16 Mar 2020 15:44:05 +0100 (CET) Julia Lawall <[email protected]>…

On Mon, 16 Mar 2020, Stefano Brivio wrote:

[...]

Quoted 9 lines

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.

Quoted 7 lines
Quoted 3 lines

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

#9 lore raw
Quoted 23 lines · On Mon, 16 Mar 2020 16:32:47 +0100 (CET) Julia Lawall <[email protected]>…
Quoted 21 lines · Stefano Brivio
Quoted 17 lines · On Mon, 16 Mar 2020 15:44:05 +0100 (CET) Julia Lawall <[email protected]>…

On Mon, 16 Mar 2020, Stefano Brivio wrote:

[...]

Quoted 9 lines

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.

Quoted 6 lines
Quoted 3 lines

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>).

Signature · 1 line
Stefano
#10 lore raw

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

#11 lore raw
Quoted 10 lines · Lourdes Pedrajas

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 :(

Quoted 7 lines

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

Quoted 207 lines

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

(quoted diff) +0 -4
-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/.

(quoted diff) +0 -4
-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/.

(quoted diff) +0 -4
-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/.

(quoted diff) +0 -4
-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

#12 lore raw
In reply to Lourdes Pedrajas

On Thu, 19 Mar 2020 21:15:53 +0100
Lourdes Pedrajas <[email protected]> wrote:

Can you just run this spatch command:

Quoted 10 lines

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/.

(quoted diff) +0 -4
-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.

Signature · 1 line
Stefano
#13 lore raw
Quoted 5 lines · Stefano Brivio

On Thu, 19 Mar 2020 21:15:53 +0100
Lourdes Pedrajas <[email protected]> wrote:

Can you just run this spatch command:

Quoted 17 lines
Quoted 10 lines

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/.

(quoted diff) +0 -4
-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.

Signature · 1 line
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

#14 lore raw
Quoted 39 lines · Lourdes Pedrajas
Quoted 19 lines · Stefano Brivio

On Thu, 19 Mar 2020 21:15:53 +0100
Lourdes Pedrajas <[email protected]> wrote:

Can you just run this spatch command:

Quoted 10 lines

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/.

(quoted diff) +0 -4
-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.

Quoted 3 lines

--
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

(quoted diff) +0 -4
-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:

Quoted 7 lines

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

#15 lore raw
Quoted 55 lines · Julia Lawall
Quoted 39 lines · Lourdes Pedrajas
Quoted 19 lines · Stefano Brivio

On Thu, 19 Mar 2020 21:15:53 +0100
Lourdes Pedrajas <[email protected]> wrote:

Can you just run this spatch command:

Quoted 10 lines

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/.

(quoted diff) +0 -4
-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.

Quoted 3 lines

--
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

(quoted diff) +0 -4
-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:

Quoted 7 lines

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:

Quoted 7 lines

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

#16 lore raw
Quoted 58 lines · Lourdes Pedrajas
Quoted 57 lines · Julia Lawall
Quoted 39 lines · Lourdes Pedrajas
Quoted 19 lines · Stefano Brivio

On Thu, 19 Mar 2020 21:15:53 +0100
Lourdes Pedrajas <[email protected]> wrote:

Can you just run this spatch command:

Quoted 10 lines

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/.

(quoted diff) +0 -4
-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.

Quoted 3 lines

--
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

(quoted diff) +0 -4
-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:

Quoted 7 lines

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

Quoted 7 lines
Quoted 5 lines

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

#17 lore raw
Quoted 66 lines · Julia Lawall
Quoted 62 lines · Lourdes Pedrajas
Quoted 61 lines · Julia Lawall
Quoted 39 lines · Lourdes Pedrajas
Quoted 19 lines · Stefano Brivio

On Thu, 19 Mar 2020 21:15:53 +0100
Lourdes Pedrajas <[email protected]> wrote:

Can you just run this spatch command:

Quoted 10 lines

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/.

(quoted diff) +0 -4
-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.

Quoted 3 lines

--
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

(quoted diff) +0 -4
-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:

Quoted 7 lines

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

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

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

Quoted 1 line

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

#18 lore raw
Quoted 86 lines · On Thu, 19 Mar 2020 23:06:05 +0100 Lourdes Pedrajas <[email protected]> wrote:
Quoted 66 lines · Julia Lawall
Quoted 62 lines · Lourdes Pedrajas
Quoted 61 lines · Julia Lawall
Quoted 39 lines · Lourdes Pedrajas
Quoted 19 lines · Stefano Brivio

On Thu, 19 Mar 2020 21:15:53 +0100
Lourdes Pedrajas <[email protected]> wrote:

Can you just run this spatch command:

Quoted 10 lines

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/.

(quoted diff) +0 -4
-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.

Quoted 3 lines

--
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

(quoted diff) +0 -4
-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:

Quoted 7 lines

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

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

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

(quoted diff) +0 -4
-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
Quoted 8 lines

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

Quoted 1 line

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.

Signature · 1 line
Stefano