[Bug 297217] devel/coccinelle: fix wr ong pkg-config module for libpython

[email protected] Sat, 01 Aug 2026 08:26:56 +0000
Newsgroups gmane.os.freebsd.devel.ports.bugs
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=297217

            Bug ID: 297217
           Summary: devel/coccinelle: fix wrong pkg-config module for
                    libpython
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
             Flags: maintainer-feedback?([email protected])
                CC: [email protected]

Created attachment 273377
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=273377&action=edit
patch

spatch from coccinelle 1.3.1 dies on any semantic patch with a @script:python@
rule:

Py.find_library_path: unable to parse the output of pkg-config
'-L/usr/local/lib'
exit: 255

Cause: bundled pyml (bundles/pyml/pyml-current/py.ml) probes pkg-config --libs
python-3.12 to find libpython.
That module has an empty Libs: (it's for building extensions).
The -lpython lives in the sibling -embed module, same package:

$ pkg-config --libs python-3.12         # -L/usr/local/lib
$ pkg-config --libs python-3.12-embed   # -L/usr/local/lib -lpython3.12

pyml finds no -l, raises, and spatch aborts.


Fix:
query the -embed module. One-line patch, no new dependency (the .pc ships in
the same pythonXY package).

Reproduce / verify:

cat > /tmp/mini.cocci <<'EOF'
@r@
identifier f;
position p;
@@
f@p(...)
@script:python@
p << r.p;
@@
print("hit: %s:%s" % (p[0].file, p[0].line))
EOF

printf 'void foo(void) { bar(1); }\n' > /tmp/mini.c
spatch --very-quiet --sp-file /tmp/mini.cocci /tmp/mini.c; echo "exit: $?"

Before the patch:
unable to parse... / exit 255.

After the patch:
hit: /tmp/mini.c:1 / exit 0.

-- 
You are receiving this mail because:
You are the assignee for the bug.