Hello,
when I run
/usr/bin/spatch -D report --no-show-diff --very-quiet --cocci-file
scripts/coccinelle/api/kfree_mismatch.cocci --no-includes
--include-headers
--dir . -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/compiler-version.h
--include ./include/linux/kconfig.h --jobs 4 --chunksize 1
in the kernel source tree (which is also what
make coccicheck COCCI=scripts/coccinelle/api/kfree_mismatch.cocci
does), I get:
Cannot find Python library
When running that under strace I see it tries to execute "python":
$ strace -f -e execve,openat /usr/bin/spatch -D report --no-show-diff
--very-quiet --cocci-file scripts/coccinelle/api/kfree_mismatch.cocci
--no-includes --include-headers --dir . -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/compiler-version.h --include
./include/linux/kconfig.h --jobs 4 --chunksize 1
execve("/usr/bin/spatch", ["/usr/bin/spatch", "-D", "report",
"--no-show-diff",
"--very-quiet", "--cocci-file", "scripts/coccinelle/api/kfree_mis"...,
"--no-includes", "--include-headers", "--dir", ".", "-I",
"./arch/x86/include",
"-I", "./arch/x86/include/generated", "-I", "./include", "-I",
"./arch/x86/include/uapi", "-I", "./arch/x86/include/generated/uap"...,
"-I",
"./include/uapi", "-I", "./include/generated/uapi", "--include",
"./include/linux/compiler-version"..., "--include",
"./include/linux/kconfig.h", "--jobs", "4", "--chunksize", ...],
0x7fffea5dc7a8
/* 49 vars */) = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpcre.so.3",
O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC)
= 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2",
O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpthread.so.0",
O_RDONLY|O_CLOEXEC) =
3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC)
= 3
openat(AT_FDCWD, "/sys/devices/system/cpu/online", O_RDONLY|O_CLOEXEC)
= 3
openat(AT_FDCWD, "/dev/urandom", O_RDONLY) = 3
openat(AT_FDCWD, "scripts/coccinelle/api/kfree_mismatch.cocci",
O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, ".cocciconfig", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/usr/lib/coccinelle/standard.h", O_RDONLY|O_CLOEXEC)
= 4
openat(AT_FDCWD, "scripts/coccinelle/api/kfree_mismatch.cocci",
O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "scripts/coccinelle/api/kfree_mismatch.cocci",
O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/usr/lib/coccinelle/standard.iso",
O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/usr/lib/coccinelle/standard.iso",
O_RDONLY|O_CLOEXEC) = 4
strace: Process 122721 attached
-> [pid 122721] execve("/bin/sh", ["/bin/sh", "-c", "command -v \"python\""],
0x55c019d188b0 /* 50 vars */) = 0
[pid 122721] openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) =
3
[pid 122721] openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6",
O_RDONLY|O_CLOEXEC) = 3
[pid 122721] +++ exited with 127 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=122721,
si_uid=1000,
si_status=127, si_utime=0, si_stime=0} ---
strace: Process 122722 attached
[pid 122722] execve("/bin/sh", ["/bin/sh", "-c", "ldconfig -p"],
0x55c019d188b0
/* 50 vars */) = 0
[pid 122722] openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) =
3
[pid 122722] openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6",
O_RDONLY|O_CLOEXEC) = 3
[pid 122722] +++ exited with 127 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=122722,
si_uid=1000,
si_status=127, si_utime=0, si_stime=0} ---
Cannot find Python library
+++ exited with 255 +++
When installing python-is-python3 the spatch command above start to do
something sensible. I'm not entirely sure but I think this is a problem
in the coccinelle binary and not the cocci patch. As coccinelle depends
on python3:any it should better try to call python3 explicitly.