#1093903 mailman3: mailman-wrapper -h yields python backtrace

#1093903#5
Date:
2025-01-23 22:46:44 UTC
From:
To:
Dear Maintainer,

If I do
   sudo mailman-wrapper cli
I see:
If I do
   sudo mailman-wrapper cli
I see:
Usage: mailman [OPTIONS] COMMAND [ARGS]...
Try 'mailman -h' for help.

Error: No such command 'cli'.

If I do
   sudo mailman-wrapper cli
I see:
Usage: mailman [OPTIONS] COMMAND [ARGS]...
Try 'mailman -h' for help.

Error: No such command 'cli'.

If I do
   sudo mailman-wrapper cli
I see:
Usage: mailman [OPTIONS] COMMAND [ARGS]...
Try 'mailman -h' for help.

Error: No such command 'cli'.

If I do
   sudo mailman-wrapper cli
I see:
	Usage: mailman [OPTIONS] COMMAND [ARGS]...
	Try 'mailman -h' for help.

	Error: No such command 'cli'.
If I then do:
  sudo mailman-wrapper -h
I see:
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1081, in main
    with self.make_context(prog_name, args, **extra) as ctx:
         ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 949, in make_context
    self.parse_args(ctx, args)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1653, in parse_args
    rest = super().parse_args(ctx, args)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1417, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
                  ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 2403, in handle_parse_result
    value = self.process_value(ctx, value)
  File "/usr/lib/python3/dist-packages/click/core.py", line 2365, in process_value
    value = self.callback(ctx, self, value)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 550, in show_help
    echo(ctx.get_help(), color=ctx.color)
         ~~~~~~~~~~~~^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 711, in get_help
    return self.command.get_help(self)
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1334, in get_help
    self.format_help(ctx, formatter)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1367, in format_help
    self.format_options(ctx, formatter)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mailman/bin/mailman.py", line 90, in format_options
    super().format_commands(ctx, formatter)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1625, in format_commands
    for subcommand in self.list_commands(ctx):
                      ~~~~~~~~~~~~~~~~~~^^^^^
  File "/usr/lib/python3/dist-packages/mailman/bin/mailman.py", line 48, in list_commands
    self._load()
    ~~~~~~~~~~^^
  File "/usr/lib/python3/dist-packages/mailman/bin/mailman.py", line 44, in _load
    add_components('commands', ICLISubCommand, self._commands)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mailman/utilities/modules.py", line 218, in add_components
    for component_class in find_pluggable_components(subpackage, interface):
                           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mailman/utilities/modules.py", line 181, in find_pluggable_components
    for name, plugin_config in config.plugin_configs:
                               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mailman/config/config.py", line 291, in plugin_configs
    plugin_sections = self._config.getByCategory('plugin', [])
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'getByCategory'

whan I expect the same output as  from `sudo mailman-wrapper help`

#1093903#10
Date:
2025-08-25 05:13:44 UTC
From:
To:
If I explicitly give the c onfig file things work:
	sudo -u list mailman -C /etc/mailman3/mailman.cfg -h
works correctly.

#1093903#15
Date:
2026-07-22 19:56:03 UTC
From:
To:
This bug (from Jan 2025) was reported independently to upstream (March
2026): https://gitlab.com/mailman/mailman/-/work_items/1264

Changing /usr/bin/mailman-wrapper from:
--------- #!/bin/sh su -s /bin/sh -c "mailman $*" list --------- to (adds -C /etc/mailman3/mailman.cfg): --------- #!/bin/sh su -s /bin/sh -c "mailman -C /etc/mailman3/mailman.cfg $*" list --------- Is a way to avoid the problem. It should still be fixed in upstream.