Bug 2220829

Summary: config-manager plug-in doesn't work with system es_PE locale
Product: Red Hat Enterprise Linux 9 Reporter: Marc Muehlfeld <mmuehlfe>
Component: dnf-plugins-coreAssignee: Pavla Kratochvilova <pkratoch>
Status: POST --- QA Contact: swm-qe
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.2CC: james.antill, pkratoch, ppisar
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marc Muehlfeld 2023-07-06 07:45:21 UTC
Description of problem:
When RHEL is configured to use the en_PE locale, the config-manager plug-in doesn't work. Additionally, each dnf command shows:
> Error al cargar el complemento "config_manager": '*prog'

> Translation: Error loading "config_manager" plugin: '*prog'.


Version-Release number of selected component (if applicable):
dnf-plugins-core-4.3.0-5.el9_2.noarch


How reproducible:
Always


Steps to Reproduce:
1. Install the langpacks-es.noarch package:
   # dnf install langpacks-es.noarch

2. Switch locale to en_PE:
   # localectl set-locale es_PE

3. Log out / Log in.

4. Run a dnf command that requires the config-manager plug-in:
   # dnf config-manager --enable codeready-builder-for-rhel-9-x86_64-rpm


Actual results:
Error al cargar el complemento "config_manager": '*prog'
...
Podr�a ser un comando del complemento DNF, intente: "dnf install 'dnf-command(config-manager)'"


Expected results:
dnf commands that require the config-manager plug-in should succeed. The error shouldn't be shown in every dnf command.


Additional info:
"dnf update" and "dnf install" work, but commands that require the config-manager plug-in fail.

Comment 1 Marc Muehlfeld 2023-07-06 07:54:09 UTC
This problem was identified in https://access.redhat.com/discussions/7020735

Comment 2 Petr Pisar 2023-07-24 15:05:53 UTC
A minimal reproducer:

# dnf install python3-dnf-plugins-core glibc-langpack-es
[...]
# LC_ALL=es_PE.UTF-8 dnf config-manager --dump
Error al cargar el complemento "config_manager": '*prog'
No existe el comando: config-manager. Por favor, utilice /usr/bin/dnf --help
Podría ser un comando del complemento DNF, intente: "dnf install 'dnf-command(config-manager)'"

python3-dnf-plugins-core-4.3.0-9.el9.noarch is also affected.

Comment 3 Petr Pisar 2023-07-24 15:17:27 UTC
/usr/share/locale/es/LC_MESSAGES/dnf-plugins-core.mo contains this suspicious translation:

msgid "manage {prog} configuration options and repositories"
msgstr "Dirige {*prog} opciones de configuración y repositorios"

/usr/lib/python3.9/site-packages/dnf-plugins/config_manager.py contains this Python code:

    summary = _('manage {prog} configuration options and repositories').format(
        prog=dnf.util.MAIN_PROG)

The spurious asterisk character triggers a Python exception when formatting the string:

$ python3 -c 'print("{prog}".format(prog="foo"))'
foo
$ python3 -c 'print("{*prog}".format(prog="foo"))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
KeyError: '*prog'

Which is interpreted by DNF as a failure when loading a plugin for config-manager subcommand.

The Spanish translation needs this fix:

 msgid "manage {prog} configuration options and repositories"
-msgstr "Dirige {*prog} opciones de configuración y repositorios"
+msgstr "Dirige {prog} opciones de configuración y repositorios"

Comment 4 Petr Pisar 2023-07-24 15:26:19 UTC
This issue has already been fixed in upstream commit <https://github.com/rpm-software-management/dnf-plugins-core/commit/3f6e34c47ec11b0572ded83f3c54a89c24b22c99>.