We have a CI test that started failing on F41 and I believe its triggered by Python update 3.12 -> 3.13. Though this might be a SWIG issue, I am not sure. Reproducible: Always Steps to Reproduce: 1. Run the following script: import dnf p = "./\uDCFC.conf" f = open(p, "a") f.write("[main]") f.close() conf = dnf.conf.Conf() conf.read(p) print(conf) Actual Results: Segmentation fault (core dumped) Expected Results: On F40 (with python3.12) it throws an exception.
Using python3-debug: >>> conf.read(p) Fatal Python error: _Py_CheckSlotResult: Slot __getitem__ of type dict succeeded with an exception set Python runtime state: initialized UnicodeEncodeError: 'utf-8' codec can't encode character '\udcfc' in position 2: surrogates not allowed Current thread 0x00007f3ae185bb80 (most recent call first): File "/usr/lib64/python3.13/site-packages/libdnf/conf.py", line 1649 in read File "/usr/lib64/python3.13/site-packages/libdnf/conf.py", line 1734 in ConfigParser__newRead File "/usr/lib/python3.13/site-packages/dnf/conf/config.py", line 474 in read File "<python-input-3>", line 1 in <module> File "/usr/lib64/python3.13/code.py", line 92 in runcode File "/usr/lib64/python3.13/_pyrepl/console.py", line 205 in runsource File "/usr/lib64/python3.13/code.py", line 313 in push File "/usr/lib64/python3.13/_pyrepl/simple_interact.py", line 160 in run_multiline_interactive_console File "/usr/lib64/python3.13/_pyrepl/main.py", line 59 in interactive_console File "/usr/lib64/python3.13/_pyrepl/__main__.py", line 6 in <module> File "/usr/lib64/python3.13/runpy.py", line 88 in _run_code File "/usr/lib64/python3.13/runpy.py", line 198 in _run_module_as_main Extension modules: libdnf._error, libdnf._common_types, libdnf._conf, libdnf._module, libdnf._repo, libdnf._transaction, libdnf._utils, rpm._rpm, hawkey._hawkey, libcomps._libpycomps, libdnf._smartcols (total: 11) Aborted (core dumped)
Using python3-debug on Fedora 40: >>> conf.read(p) Fatal Python error: _Py_CheckSlotResult: Slot __getitem__ of type dict succeeded with an exception set Python runtime state: initialized UnicodeEncodeError: 'utf-8' codec can't encode character '\udcfc' in position 2: surrogates not allowed Current thread 0x00007f1109103b80 (most recent call first): File "/usr/lib64/python3.12/site-packages/libdnf/conf.py", line 1649 in read File "/usr/lib64/python3.12/site-packages/libdnf/conf.py", line 1734 in ConfigParser__newRead File "/usr/lib/python3.12/site-packages/dnf/conf/config.py", line 474 in read File "<stdin>", line 1 in <module> Extension modules: libdnf._error, libdnf._common_types, libdnf._conf, libdnf._module, libdnf._repo, libdnf._transaction, libdnf._utils, rpm._rpm, hawkey._hawkey, libcomps._libpycomps, libdnf._smartcols (total: 11) Aborted (core dumped) --- So something was always bad here, but Python 3.13 only exposes the crash.
(gdb) bt #0 SWIG_MangledTypeQueryModule (start=start@entry=0x0, end=end@entry=0x0, name=name@entry=0x7ffff696cc1f "std::string *") at /usr/src/debug/libdnf-0.73.3-1.fc42.x86_64/build-py3/bindings/python/CMakeFiles/_conf.dir/confPYTHON_wrap.cxx:624 #1 0x00007ffff6904f90 in SWIG_TypeQueryModule (start=0x0, end=0x0, name=0x7ffff696cc1f "std::string *") at /usr/src/debug/libdnf-0.73.3-1.fc42.x86_64/build-py3/bindings/python/CMakeFiles/_conf.dir/confPYTHON_wrap.cxx:668 #2 SWIG_Python_TypeQuery (type=type@entry=0x7ffff696cc1f "std::string *") at /usr/src/debug/libdnf-0.73.3-1.fc42.x86_64/build-py3/bindings/python/CMakeFiles/_conf.dir/confPYTHON_wrap.cxx:2974 #3 0x00007ffff69083bc in SWIG_AsPtr_std_string (obj=0x7ffff724fc90, val=0x7fffffffd738) at /usr/src/debug/libdnf-0.73.3-1.fc42.x86_64/build-py3/bindings/python/CMakeFiles/_conf.dir/confPYTHON_wrap.cxx:4078 #4 0x00007ffff69344d4 in _wrap_ConfigParser_read (self=<optimized out>, args=<optimized out>) at /usr/src/debug/libdnf-0.73.3-1.fc42.x86_64/build-py3/bindings/python/CMakeFiles/_conf.dir/confPYTHON_wrap.cxx:27341 #5 0x00007ffff7b707f2 in cfunction_call (func=0x7ffff6d81990, args=0x7ffff431b1c0, kwargs=<optimized out>) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Objects/methodobject.c:551 #6 0x00007ffff7b3862b in _PyObject_MakeTpCall (tstate=0x7ffff7f3a860 <_PyRuntime+282976>, callable=0x7ffff6d81990, args=<optimized out>, nargs=2, keywords=0x0) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Objects/call.c:242 #7 0x00007ffff7b51e2f in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=<optimized out>, throwflag=<optimized out>) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Python/generated_cases.c.h:813 #8 0x00007ffff7c1de7b in PyEval_EvalCode (co=0x7ffff42f9c50, globals=<optimized out>, locals=0x7ffff74983c0) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Python/ceval.c:596 #9 0x00007ffff7c37f94 in builtin_exec_impl (module=<optimized out>, source=0x7ffff42f9c50, globals=0x7ffff74983c0, locals=0x7ffff74983c0, closure=<optimized out>) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Python/bltinmodule.c:1145 #10 builtin_exec (module=<optimized out>, args=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Python/clinic/bltinmodule.c.h:556 #11 0x00007ffff7b4f86f in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=<optimized out>, throwflag=<optimized out>) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Python/generated_cases.c.h:1217 #12 0x00007ffff7c1de7b in PyEval_EvalCode (co=0x7ffff7251630, globals=<optimized out>, locals=0x7ffff74983c0) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Python/ceval.c:596 #13 0x00007ffff7c37f94 in builtin_exec_impl (module=<optimized out>, source=0x7ffff7251630, globals=0x7ffff74983c0, locals=0x7ffff74983c0, closure=<optimized out>) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Python/bltinmodule.c:1145 #14 builtin_exec (module=<optimized out>, args=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Python/clinic/bltinmodule.c.h:556 #15 0x00007ffff7b682e7 in cfunction_vectorcall_FASTCALL_KEYWORDS (func=0x7ffff76661b0, args=0x7ffff7fb5180, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Include/cpython/methodobject.h:50 #16 0x00007ffff7b3bfd7 in _PyObject_VectorcallTstate (tstate=0x7ffff7f3a860 <_PyRuntime+282976>, callable=0x7ffff76661b0, args=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Include/internal/pycore_call.h:168 #17 PyObject_Vectorcall (callable=0x7ffff76661b0, args=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Objects/call.c:327 #18 0x00007ffff7b51e2f in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=<optimized out>, throwflag=<optimized out>) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Python/generated_cases.c.h:813 #19 0x00007ffff7c56bcd in pymain_run_module (modname=modname@entry=0x7ffff7e02170 L"_pyrepl", set_argv0=set_argv0@entry=0) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Modules/main.c:349 #20 0x00007ffff7a56d27 in pymain_run_stdin (config=0x7ffff7f0cf58 <_PyRuntime+96344>) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Modules/main.c:574 #21 pymain_run_python (exitcode=0x7fffffffe0fc) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Modules/main.c:699 #22 Py_RunMain () at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Modules/main.c:775 #23 0x00007ffff7c0d17c in Py_BytesMain (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/python3.13-3.13.0-1.fc42.x86_64/Modules/main.c:829 #24 0x00007ffff78121c8 in __libc_start_call_main (main=main@entry=0x555555555160 <main>, argc=argc@entry=1, argv=argv@entry=0x7fffffffe368) at ../sysdeps/nptl/libc_start_call_main.h:58 #25 0x00007ffff781228b in __libc_start_main_impl (main=0x555555555160 <main>, argc=1, argv=0x7fffffffe368, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe358) at ../csu/libc-start.c:360 #26 0x0000555555555095 in _start ()
I have very little experience with SWIG. Something either there or in libdnf is not checking for exceptions properly. Not sure why it now crashes the interpreter that is not built in debug mode.
It looks like a bug in libdnf which doesn't handle properly an exception. I change the ticket component to libdnf.
Thanks for the help, it turned out to be a swig issue. It is fixed in upstream: https://github.com/swig/swig/issues/3051
(In reply to amatej from comment #6) > Thanks for the help, it turned out to be a swig issue. > > It is fixed in upstream: https://github.com/swig/swig/issues/3051 I will apply the fix to Fedora 41. Swig 4.3.0 contains some incompatible changes, so I want to add it only to Fedora Rawhide(42).
FEDORA-2024-2c6b05124b (swig-4.2.1-9.fc41) has been submitted as an update to Fedora 41. https://bodhi.fedoraproject.org/updates/FEDORA-2024-2c6b05124b
FEDORA-2024-2c6b05124b has been pushed to the Fedora 41 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-2c6b05124b` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-2c6b05124b See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2024-2c6b05124b (swig-4.2.1-9.fc41) has been pushed to the Fedora 41 stable repository. If problem still persists, please make note of it in this bug report.