Bug 1273844

Summary: Unicode error on "dnf info" in C locale
Product: [Fedora] Fedora Reporter: Stephen Tweedie <sct>
Component: dnfAssignee: rpm-software-management
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: jsilhan, mluscon, packaging-team-maint, pnemade, ssmetana, vmukhame
Target Milestone: ---Keywords: EasyFix, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-1.1.9 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-01 10:23:30 UTC 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 Stephen Tweedie 2015-10-21 11:44:18 UTC
Description of problem:
"dnf info Agda" fails with a Unicode traceback when run in C locale.

Version-Release number of selected component (if applicable):
dnf-1.1.3-1.fc23.noarch

How reproducible:
100%

Steps to Reproduce:
1. LANG=C dnf info Agda

Actual results:
Traceback (most recent call last):
  File "/usr/bin/dnf", line 35, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 198, in user_main
    errcode = main(args)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 84, in main
    return _main(base, args)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 136, in _main
    cli.run()
  File "/usr/lib/python3.4/site-packages/dnf/cli/cli.py", line 1091, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/__init__.py", line 258, in run
    return self.base.output_packages('info', pkgnarrow, patterns)
  File "/usr/lib/python3.4/site-packages/dnf/cli/cli.py", line 435, in output_packages
    '=' : clar, 'not in' : clai})
  File "/usr/lib/python3.4/site-packages/dnf/cli/output.py", line 606, in listPkgs
    self.infoOutput(pkg, highlight=highlight)
  File "/usr/lib/python3.4/site-packages/dnf/cli/output.py", line 502, in infoOutput
    print_key_val_fill(_("Description"), pkg.description)
  File "/usr/lib/python3.4/site-packages/dnf/cli/output.py", line 462, in print_key_val_fill
    " : ", val or ""))
  File "/usr/lib/python3.4/site-packages/dnf/i18n.py", line 44, in write
    self.stream.write(s)
UnicodeEncodeError: 'ascii' codec can't encode character '\xf6' in position 727: ordinal not in range(128)


Expected results:
No crash.

Additional info:
Fails both on a f23 host and in an f23 docker container.  Both environments fully updated with fedora-updates-testing.

The error is locale-dependent ---

$ LANG=C dnf info Agda
fails with the error above; but
$ LANG=en_GB.UTF-8 dnf info Agda
succeeds on the same system.

Comment 1 Fedora Admin XMLRPC Client 2016-07-08 09:35:15 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 2 Štěpán Smetana 2016-08-01 10:23:30 UTC
Works for me.
Should be fixed in dnf-1.1.9 (Take a look at this commit https://github.com/rpm-software-management/dnf/commit/93159e360f0b6150e598bba783e22ca113201a40)
In case reopen this bug and provide more info.
Thanks

*** This bug has been marked as a duplicate of bug 1295090 ***