Bug 2093923 - 389-ds-base fails to build with Python 3.11: argparse.ArgumentError: argument {show,enable,disable,status}: conflicting subparser: enable
Summary: 389-ds-base fails to build with Python 3.11: argparse.ArgumentError: argument...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: 389-ds-base
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: mreynolds
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2022-06-06 11:47 UTC by Tomáš Hrnčiar
Modified: 2022-06-16 15:59 UTC (History)
7 users (show)

Fixed In Version: 389-ds-base-2.2.1-4.fc37
Clone Of:
Environment:
Last Closed: 2022-06-16 15:59:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2022-06-06 11:47:34 UTC
389-ds-base fails to build with Python 3.11.0b3.

Traceback (most recent call last):
  File "/builddir/build/BUILD/389-ds-base-2.2.1/src/lib389/setup.py", line 46, in <module>
    setup(
    ^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/__init__.py", line 155, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 148, in setup
    return run_commands(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
    dist.run_commands()
    ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
    self.run_command(cmd)
    ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
    cmd_obj.run()
    ^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
    cmd_obj.run()
    ^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/build_manpages/build_manpages.py", line 103, in run
    self.run_command(DEFAULT_CMD_NAME)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
    cmd_obj.run()
    ^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/build_manpages/build_manpages.py", line 89, in run
    parser = get_parser(data['import_type'], data['import_from'], data['objname'], data['objtype'], data.get('prog', None))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/build_manpages/build_manpage.py", line 93, in get_parser
    return get_parser_from_file(import_from, objname, objtype, prog=prog)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/build_manpages/build_manpage.py", line 81, in get_parser_from_file
    module_loaded = imp.load_source("argparse_manpage_loaded_file", filename)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/imp.py", line 172, in load_source
    module = _load(spec)
             ^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 721, in _load
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 939, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "cli/dsconf", line 83, in <module>
    cli_plugin.create_parser(subparsers)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/389-ds-base-2.2.1/src/lib389/lib389/cli_conf/plugin.py", line 115, in create_parser
    cli_passthroughauth.create_parser(subcommands)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/389-ds-base-2.2.1/src/lib389/lib389/cli_conf/plugins/passthroughauth.py", line 241, in create_parser
    enable = subcommands.add_parser('enable', help='Enable the pass through authentication plugins')
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/argparse.py", line 1185, in add_parser
    raise ArgumentError(self, _('conflicting subparser: %s') % name)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
argparse.ArgumentError: argument {show,enable,disable,status}: conflicting subparser: enable
error: Bad exit status from /var/tmp/rpm-tmp.4gJEuZ (%build)

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

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

For all our attempts to build 389-ds-base with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/389-ds-base/

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 Viktor Ashirov 2022-06-06 13:26:49 UTC
This is caused by this fix in argparse: https://github.com/python/cpython/pull/18605

bpo-39716: Raise on conflicting subparser names.
Raise an ArgumentError when the same subparser name is added twice to an
ArgumentParser.  This is consistent with the (default) behavior when the
same option string is added twice to an ArgumentParser.

(Support for `conflict_handler="resolve"` could be considered as a
followup feature, although real use cases seem even rarer than
"resolve"ing option-strings.)


Indeed, pass-through-auth plugin defines `enable` and `disable` twice:
 
[root@server ds]# dsconf localhost plugin pass-through-auth --help
usage: dsconf instance plugin pass-through-auth [-h] {show,enable,disable,status,list,url,pam-config} ...

positional arguments:
  {show,enable,disable,status,list,url,pam-config}
                        action
    show                Displays the plugin configuration
 -> enable              Enables the plugin
 -> disable             Disables the plugin
    status              Displays the plugin status
 -> enable              Enable the pass through authentication plugins
 -> disable             Disable the pass through authentication plugins
    list                List pass-though plugin URLs or PAM configurations
    url                 Manage PTA URL configurations
    pam-config          Manage PAM PTA configurations.

options:
  -h, --help            show this help message and exit


Fix is to remove overrides from pass-through-auth plugin:

diff --git a/src/lib389/lib389/cli_conf/plugins/passthroughauth.py b/src/lib389/lib389/cli_conf/plugins/passthroughauth.py
index 7bb1b95a8..5c7dbc82e 100644
--- a/src/lib389/lib389/cli_conf/plugins/passthroughauth.py
+++ b/src/lib389/lib389/cli_conf/plugins/passthroughauth.py
@@ -238,12 +238,6 @@ def create_parser(subparsers):
     subcommands = passthroughauth_parser.add_subparsers(help='action')
     add_generic_plugin_parsers(subcommands, PassThroughAuthenticationPlugin)

-    enable = subcommands.add_parser('enable', help='Enable the pass through authentication plugins')
-    enable.set_defaults(func=enable_plugins)
-
-    disable = subcommands.add_parser('disable', help='Disable the pass through authentication plugins')
-    disable.set_defaults(func=disable_plugins)
-
     list = subcommands.add_parser('list', help='List pass-though plugin URLs or PAM configurations')
     subcommands_list = list.add_subparsers(help='action')
     list_urls = subcommands_list.add_parser('urls', help='Lists URLs')

Comment 2 Miro Hrončok 2022-06-16 15:45:13 UTC
389-ds-base sounds like an important package for the IDM stack and the Python 3.11 rebuild is almost done now.

Please fix this through your upstream channels ASAP or we will apply the fix from the previous comment as a downstream-only patch. Thanks

Comment 3 Miro Hrončok 2022-06-16 15:46:38 UTC
Actually, the latest version might contain this fix. Testing.

Comment 4 Miro Hrončok 2022-06-16 15:59:14 UTC
Indeed. Thanks.


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