Bug 2062150 - sudo fails to build with Python 3.11: Enhanced error locations in tracebacks are breaking the tests
Summary: sudo fails to build with Python 3.11: Enhanced error locations in tracebacks ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: sudo
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Radovan Sroka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: F37BetaBlocker
Blocks: PYTHON3.11 F37FTBFS
TreeView+ depends on / blocked
 
Reported: 2022-03-09 10:04 UTC by Tomáš Hrnčiar
Modified: 2022-07-31 15:26 UTC (History)
11 users (show)

Fixed In Version: sudo-1.9.11-3.p3.fc37
Clone Of:
Environment:
Last Closed: 2022-06-22 20:53:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2022-03-09 10:04:05 UTC
sudo fails to build with Python 3.11.0a5.

Running test check_example_io_plugin_fails_with_python_backtrace() ... 
Expectation failed at ./regress/testhelpers.c:98:
  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:372:
  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:1527

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'
Running test check_io_plugin_callbacks_are_optional() ... 
Running test check_io_plugin_reports_error() ... 
Running test check_plugin_unload() ... 
Running test check_example_group_plugin() ... 
Running test check_example_group_plugin_is_able_to_debug() ... 
Expectation failed at ./regress/testhelpers.c:98:
  actual is <<SudoGroupPlugin.__init__ was called with arguments: () [('args', ('ModulePath=SRC_DIR/example_group_plugin.py', 'ClassName=SudoGroupPlugin')), ('version', '1.0')]
SudoGroupPlugin.__init__ returned result: <example_group_plugin.SudoGroupPlugin object>
SudoGroupPlugin.query was called with arguments: ('user', 'group', ('pw_name', 'pw_passwd', 1001, 101, 'pw_gecos', 'pw_dir', 'pw_shell')) 
SudoGroupPlugin.query returned result: 0 
>>: actual_content
  expected to be <<SudoGroupPlugin.__init__ was called with arguments: () [('args', ('ModulePath=SRC_DIR/example_group_plugin.py', 'ClassName=SudoGroupPlugin')), ('version', '1.0')]
SudoGroupPlugin.__init__ returned result: <example_group_plugin.SudoGroupPlugin object>
SudoGroupPlugin.query was called with arguments: ('user', 'group', ('pw_name', 'pw_passwd', 1001, 101, 'pw_gecos', 'pw_dir', 'pw_shell')) 
SudoGroupPlugin.query returned result: REJECT 
>>: expected_output
Expectation failed at ./regress/testhelpers.c:228:
  actual is <<0>>: verify_content(stored_str, reference_path)
  not expected to be <<0>>: 0
Expectation failed at ./regress/check_python_examples.c:513:
  actual is <<0>>: verify_log_lines(expected_path("check_example_group_plugin_is_able_to_debug.log"))
  not expected to be <<0>>: 0
FAILED: testcase check_example_group_plugin_is_able_to_debug() at ./regress/check_python_examples.c:1533

https://docs.python.org/3.11/whatsnew/3.11.html#enhanced-error-locations-in-tracebacks

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

For all our attempts to build sudo with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/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.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
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 Todd C. Miller 2022-04-12 01:06:21 UTC
This is fixed by https://www.sudo.ws/repos/sudo/rev/f6a5d1c05b2b

Comment 2 Miro Hrončok 2022-06-22 08:31:04 UTC
*** Bug 2099967 has been marked as a duplicate of this bug. ***

Comment 3 Miro Hrončok 2022-06-22 09:01:42 UTC
I am nominating this as a beta blocker because this pulls in Python 3.10 to (at least) Fedora-KDE-Live-x86_64 making the image unnecessarily big. Now I don't know if this actually violates any criterion, but we should not ship official images with some apps using the previous Python version.

Comment 4 Miro Hrončok 2022-06-22 09:41:03 UTC
As well as Fedora-Workstation-Live-x86_64.

Comment 5 Radovan Sroka 2022-06-22 12:43:56 UTC
Hello, I'm going to fix this right now.

Comment 6 Miro Hrončok 2022-06-22 20:53:51 UTC
Thanks.


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