On Wed, May 14, 2025 at 6:03 PM Eric Blake <ebl...@redhat.com> wrote: > > On Wed, May 14, 2025 at 05:06:17PM -0400, Nikolaos Chatzikonstantinou wrote: > > > But looking further, I see that you are the author of pygnuregex, > > > according to https://codeberg.org/annoyingusername/pygnuregex > > > > To fix this issue: > > > > 1. Pull v0.6.3 (or later) > > 2. After activating the virtual shell, rerun `pip install -e .[tests]` > > once to grab the latest version of pygnuregex for m4p. > > > > I wrote pygnuregex because Python did not support the GNU-style regex > > of m4 despite its many regex packages. Pygnuregex is just Python FFI > > into C's <regex.h>, but due to some weaknesses of Python's FFI I had > > to write a tiny C shim library to provide certain constants (like > > sizeof (regex_t)). Python packages come "source-only" and "binary"; I > > (incorrectly) shipped a .so binary for "any platform", and yours was > > incompatible with mine (amd64 and certain glibc). The easiest path > > forward for me was to disable binary distribution in pygnuregex 1.1.4, > > pushing the compilation of the C shim down to the user who installs > > m4p. > > Nope, still dumping core: > > Installing collected packages: pygnuregex, m4p > Attempting uninstall: pygnuregex > Found existing installation: pygnuregex 1.1.3 > Uninstalling pygnuregex-1.1.3: > Successfully uninstalled pygnuregex-1.1.3 > Attempting uninstall: m4p > Found existing installation: m4p 0.6.0 > Uninstalling m4p-0.6.0: > Successfully uninstalled m4p-0.6.0 > Successfully installed m4p-0.6.3 pygnuregex-1.1.4 > (.venv) > $ m4p > regexp(abc,b) > Segmentation fault (core dumped) > (.venv) > $ python > Python 3.13.3 (main, Apr 22 2025, 00:00:00) [GCC 15.0.1 20250418 (Red Hat > 15.0.1-0)] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> import pygnuregex > >>> pygnuregex.compile(b"a") > Segmentation fault (core dumped) > (.venv)
Someone else on a forum helped me debug this. He noticed that the Python pointer was different from the one received by the underlying C function (by printing the Python pointer and inspecting the C pointer with gdb). In fact it was truncated to 32 bits. We eventually brainstormed that it was because I had neglected to add the argument types for the C functions. I'm not sure why there is a difference in Python 3.10 (where I verified the crash in a VM) versus Python 3.11. At any rate, please update to v0.6.4 and you should be able to proceed. Regards, Nikolaos Chatzikonstantinou