On Wed, May 14, 2025 at 3:24 PM Eric Blake <ebl...@redhat.com> wrote: > > On Wed, May 14, 2025 at 02:18:09PM -0500, Eric Blake wrote: > > Here's the next one that's preventing me from testing m4p on a corpus > > of m4 scripts I have handy: > > > > $ m4p > > patsubst(abc,\(b\),.\1.) > > Segmentation fault (core dumped) > > > > In fact, even simpler: > > > > $ . .venv/bin/activate > > $ 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 > > >>> p = pygnuregex.compile(b"a") > > Segmentation fault (core dumped) > > > > So obviously, I don't have my environment set up correctly to do > > regex. But I'm at a loss on how to fix it (I'm unfamiliar enough with > > pip that I won't rule out having created the venv incorrectly). > > In case it helps, here's (part of) the output from when I set up the > venv: > > $ pip install -e .[tests] > Obtaining file:///home/eblake/m4p > ... > Building wheels for collected packages: m4p > Building editable for m4p (pyproject.toml) ... done > Created wheel for m4p: filename=m4p-0.6.0-0.editable-py3-none-any.whl > size=15465 > sha256=b9073318596d9a8f9998f492c3b1ab8cc30a9ff53fcf179f163ecb20ac6e9be6 > Stored in directory: > /tmp/pip-ephem-wheel-cache-q6391xd5/wheels/de/0c/56/03e07d40c6de0241dd1e7fac70113d9769caedaf821b58deaa > Successfully built m4p > Installing collected packages: pygnuregex, pluggy, packaging, lark, > iniconfig, attrs, pytest, m4p > Successfully installed attrs-25.3.0 iniconfig-2.1.0 lark-1.2.2 m4p-0.6.0 > packaging-25.0 pluggy-1.5.0 pygnuregex-1.1.3 pytest-8.3.5 > > 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. Regards, Nikolaos Chatzikonstantinou