#1110513 coccinelle: linked against wrong libraries

Package:
coccinelle
Source:
coccinelle
Description:
semantic patching tool for C
Submitter:
Petr Malat
Date:
2025-08-27 11:03:02 UTC
Severity:
normal
#1110513#5
Date:
2025-08-07 08:27:22 UTC
From:
To:
Spatch seems to be wrongly linked as the following command:
spatch -D report --no-show-diff --very-quiet --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes --include-headers --dir . -I ./arch/mips/include -I ./arch/mips/include/generated -I ./include -I ./arch/mips/include/uapi -I ./arch/mips/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/compiler-version.h --include ./include/linux/kconfig.h --jobs 4 --chunksize 1

Fails with:
Py.find_library: unable to find the Python library [libpython3.13m.so returned libpython3.13m.so: cannot open shared object file: No such file or directory] [/usr/bin/../lib/libpython3.13m.so returned /usr/bin/../lib/libpython3.13m.so: cannot open shared object file: No such file or directory] [libpython3.13.so returned libpython3.13.so: cannot open shared object file: No such file or directory] [/usr/bin/../lib/libpython3.13.so returned /usr/bin/../lib/libpython3.13.so: cannot open shared object file: No such file or directory] [libpython3.13m.so returned libpython3.13m.so: cannot open shared object file: No such file or directory] [/usr/lib/libpython3.13m.so returned /usr/lib/libpython3.13m.so: cannot open shared object file: No such file or directory] [libpython3.13.so returned libpython3.13.so: cannot open shared object file: No such file or directory] [/usr/lib/libpython3.13.so returned /usr/lib/libpython3.13.so: cannot open shared object file: No such file or directory]

The command is what the kernel makefile runs when one does:
make coccicheck MODE=report

#1110513#10
Date:
2025-08-07 11:22:19 UTC
From:
To:
Hi,

Strange. I cannot reproduce this.
in the kernel tree obrained from a 6.16 tarball on kernel.org:

% make coccicheck MODE=report

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

/usr/bin/spatch -D report --no-show-diff --very-quiet --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes --include-headers --dir . -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/compiler-version.h --include ./include/linux/kconfig.h --jobs 4 --chunksize 1
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
15212 files match

and then it starts 4 processes which I killed after several minutes,
these processes have not produced any further output.

What happens on your system when you execute, in the source tree of the
debian package of coccinelle, ./debian/tests/cocci-demo ?

#1110513#15
Date:
2025-08-07 21:33:56 UTC
From:
To:
Hi!
Maybe the problem is I installed sid into chroot using mmdebstrap on
stable. I will try a regular install using qemu the next week.
That passes, but I think it's because ./demos/simple.cocci doesn't use python.

Thanks,
  Petr

#1110513#20
Date:
2025-08-27 11:01:21 UTC
From:
To:
I've been running into a similar issue in the Coccinelle CI since Trixie
became stable.

 > That passes, but I think it's because ./demos/simple.cocci doesn't
use python.

May I suggest the following command instead? That test does use Python.

$ cd coccinelle/tests/ && spatch --test ran

Expected output is:

init_defs_builtins: /usr/local/lib/coccinelle/standard.h
diff =
--- ran.c
+++ /tmp/cocci-output-67461-e997e9-ran.c
@@ -2,6 +2,7 @@ struct task_struct {
      int a;
      randomized_struct_fields_start
      int b;
+    int something;
      randomized_struct_fields_end
      int c;
  };
One file modified. Result is here: /tmp/ran.c

Victor Gambier