----- Mail original -----
> De: "Uwe Kleine-König" <uklei...@debian.org>
> À: "Debian Bug Tracking System" <sub...@bugs.debian.org>
> Envoyé: Mardi 8 Novembre 2022 18:55:35
> Objet: Bug#1023653: coccinelle: Picks up wrong Python
> Package: coccinelle
> Version: 1.1.1.deb-1+b2
> Severity: normal
> X-Debbugs-Cc: uklei...@debian.org, nicolas.pa...@univ-grenoble-alpes.fr,
> julia.law...@inria.fr
>
> 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.
Perhaps you didn't rerun make distclean, autogen and configure after removing
python 2.7?
julia
> Best regards
> Uwe
>
> -- System Information:
> Debian Release: bookworm/sid
> APT prefers testing-debug
> APT policy: (700, 'testing-debug'), (700, 'stable-security'), (700,
> 'stable-debug'), (700, 'testing'), (700, 'stable'), (600, 'unstable'), (500,
> 'unstable-debug'), (500, 'oldstable-updates'), (500, 'oldstable-debug'),
> (500,
> 'oldoldstable'), (500, 'oldstable'), (499, 'experimental')
> Architecture: amd64 (x86_64)
> Foreign Architectures: i386
>
> Kernel: Linux 6.0.0-2-amd64 (SMP w/4 CPU threads; PREEMPT)
> Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8),
> LANGUAGE=en_US:en
> Shell: /bin/sh linked to /usr/bin/dash
> Init: systemd (via /run/systemd/system)
> LSM: AppArmor: enabled
>
> Versions of packages coccinelle depends on:
> ii dpkg 1.21.9+b1
> ii libc6 2.35-4
> ii libparmap-ocaml 1.2.4-1
> ii libpcre3 2:8.39-14
> ii libstdcompat-ocaml [libstdcompat-ocaml-zkmm7] 18-1
> ii ocaml-base [ocaml-base-4.13.1] 4.13.1-3
> ii ocaml-findlib 1.9.3-1
> ii python3 3.10.6-1
>
> coccinelle recommends no packages.
>
> Versions of packages coccinelle suggests:
> pn coccinelle-doc <none>
> pn vim-addon-manager <none>
>
> -- no debconf information