Bug 2245820 - sudo fails to build with Python 3.13: Different exception formatting makes a test fail
Summary: sudo fails to build with Python 3.13: Different exception formatting makes a ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: sudo
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Radovan Sroka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2023-10-24 08:30 UTC by Karolina Surma
Modified: 2024-05-05 09:48 UTC (History)
8 users (show)

Fixed In Version: 1.9.15-3.p5
Clone Of:
Environment:
Last Closed: 2024-05-03 06:27:59 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github sudo-project sudo issues 374 0 None open check_example_io_plugin_fails_with_python_backtrace fails with Python 3.13 due to changed backtrace format 2024-05-02 23:26:10 UTC

Description Karolina Surma 2023-10-24 08:30:09 UTC
sudo fails to build with Python 3.13.0a1.

./pyhelpers.c:300:28: error: implicit declaration of function 'isdigit' [-Werror=implicit-function-declaration]
  300 |                     while (isdigit((unsigned char)*cp))
      |                            ^~~~~~~
./pyhelpers.c:29:1: note: include '<ctype.h>' or provide a declaration of 'isdigit'

According to https://docs.python.org/3.13/whatsnew/3.13.html:

Python.h no longer includes the <ctype.h> standard header file.
If needed, it should now be included explicitly.
For example, it provides isalpha() and tolower() functions which are locale dependent.
Python provides locale independent functions, like Py_ISALPHA() and Py_TOLOWER().
(Contributed by Victor Stinner in gh-108765.)


https://docs.python.org/3.13/whatsnew/3.13.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/06546855-sudo/

For all our attempts to build sudo with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/sudo/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Aoife Moloney 2024-02-15 23:01:09 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.

Comment 2 Karolina Surma 2024-05-02 08:59:52 UTC
Since the headers were brought back to Python, the problem is now (alpha 6) different. The traceback visual will be changed in Python 3.13.
Full log: https://download.copr.fedorainfracloud.org/results/@python/python3.13/fedora-rawhide-x86_64/07387722-sudo/builder-live.log.gz

Expectation failed at ./regress/testhelpers.c:139:
  actual is <<Example sudo python plugin will log to /some/not/writable/directory/sudo.log
Traceback:
  File "SRC_DIR/example_io_plugin.py", line 64, in __init__
    self._open_log_file(path.join(log_path, "sudo.log"))
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "SRC_DIR/example_io_plugin.py", line 134, in _open_log_file
    self._log_file = open(log_path, "a")
                     ~~~~^^^^^^^^^^^^^^^

>>: actual_content
  expected to be <<Example sudo python plugin will log to /some/not/writable/directory/sudo.log
Traceback:
  File "SRC_DIR/example_io_plugin.py", line 64, in __init__
    self._open_log_file(path.join(log_path, "sudo.log"))
  File "SRC_DIR/example_io_plugin.py", line 134, in _open_log_file
    self._log_file = open(log_path, "a")

>>: expected_output
Expectation failed at ./regress/check_python_examples.c:371:
  actual is <<0>>: verify_content(data.stdout_str, expected_path("check_example_io_plugin_fails_with_python_backtrace.stdout"))
  not expected to be <<0>>: 0
FAILED: testcase check_example_io_plugin_fails_with_python_backtrace() at ./regress/check_python_examples.c:1539

The output of the plugin:
Example sudo python plugin will log to /some/not/writable/directory/sudo.log
Traceback:
  File "SRC_DIR/example_io_plugin.py", line 64, in __init__
    self._open_log_file(path.join(log_path, "sudo.log"))
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "SRC_DIR/example_io_plugin.py", line 134, in _open_log_file
    self._log_file = open(log_path, "a")
                     ~~~~^^^^^^^^^^^^^^^


The error output of the plugin:
Failed to construct plugin instance: [Errno 2] No such file or directory: '/some/not/writable/directory/sudo.log'
check_python_examples: 58 tests run, 1 errors, 98% success rate
make[1]: Leaving directory '/builddir/build/BUILD/sudo-1.9.15p5/plugins/python'

Comment 3 Adam Williamson 2024-05-02 23:43:08 UTC
It's a bit hacky, but https://src.fedoraproject.org/rpms/sudo/pull-request/28 fixes this. Tested both a plain Rawhide build and a build against the Python 3.13 COPR succeed with that.

Comment 4 Adam Williamson 2024-05-03 06:27:24 UTC
OK, should be fixed by https://bodhi.fedoraproject.org/updates/FEDORA-2024-e523e57ddc when it passes tests.


Note You need to log in before you can comment on or make changes to this bug.