Skip to content

dnf4: "non-UTF-8 character in an option when using corresponding locale" scenario fails with Python 3.15.0b2 #1893

Description

@ppisar

After upgrading Python from 3.14 to 3.15.0b2, e.g. in Fedora 45, "non-UTF-8 character in an option when using corresponding locale" scenario started to fail:

  Scenario: non-UTF-8 character in an option when using corresponding locale                                    # dnf/encoding.feature:85
    Given I use repository "miscellaneous"                                                                      # dnf/steps/repo.py:184 0.067s
    And I create file "/{context.invalid_utf8_char}" with                                                       # common/file.py:36 0.000s
    And I set LC_ALL to "en_US.ISO-8859-1"                                                                      # common/cmd.py:41 0.000s
    When I execute dnf with args "install dummy --config={context.dnf.installroot}/{context.invalid_utf8_char}" # dnf/steps/cmd.py:106 0.142s
    Then the exit code is 0                                                                                     # common/output.py:57 0.000s
      Assertion Failed: Command has returned exit code 1: LC_ALL=en_US.ISO-8859-1 dnf -y --installroot=/tmp/dnf_ci_installroot_e0_mp0zo --releasever=29 --setopt=module_platform_id=platform:f29 --disableplugin='*' install dummy --config=/tmp/dnf_ci_installroot_e0_mp0zo/\udcfd
      Captured stdout:
      
      Last Command: LC_ALL=en_US.ISO-8859-1 dnf -y --installroot=/tmp/dnf_ci_installroot_e0_mp0zo --releasever=29 --setopt=module_platform_id=platform:f29 --disableplugin='*' install dummy --config=/tmp/dnf_ci_installroot_e0_mp0zo/\udcfd
      
      Last Command stderr:
      Error: Cannot encode argument '--config=/tmp/dnf_ci_installroot_e0_mp0zo/\udcfd': 'utf-8' codec can't encode character '\udcfd' in position 42: surrogates not allowed
      

    And Transaction is following                                                                                # None
      | Action  | Package              |
      | install | dummy-1:1.0-1.x86_64 |

This is probably related to this https://peps.python.org/pep-0686/ Python change effective since 3.15. Setting PYTHONUTF8=0 makes the test happy again.

The test was added because of rpm-software-management/dnf#1599. Frankly I don't understand how the test supports the DNF code. The test checks that a valid ISO-8859-1 file name passed as a program argument in the same locale can be handled by DNF. But the DNF code checks that all arguments are valid UTF-8 characters.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions