Bug 1092777 - [abrt] dnf: __init__.py:403:run:UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
[abrt] dnf: __init__.py:403:run:UnicodeDecodeError: 'ascii' codec can't decod...
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
20
x86_64 Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Honza Silhan
Fedora Extras Quality Assurance
https://retrace.fedoraproject.org/faf...
abrt_hash:4d6313c9d98044730de9371f36c...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-29 21:18 EDT by Pavel Roskin
Modified: 2014-05-31 19:57 EDT (History)
6 users (show)

See Also:
Fixed In Version: dnf-plugins-core-0.0.8-2.fc20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-05-31 19:57:26 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
File: backtrace (1.12 KB, text/plain)
2014-04-29 21:18 EDT, Pavel Roskin
no flags Details
File: environ (2.78 KB, text/plain)
2014-04-29 21:18 EDT, Pavel Roskin
no flags Details
Error messages (4.55 KB, application/octet-stream)
2014-05-07 03:18 EDT, Didier G
no flags Details

  None (edit)
Description Pavel Roskin 2014-04-29 21:18:31 EDT
Description of problem:
I mistyped the package name on the dnf with a cyrillic script:
# dnf upgrade -y дши*
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/python2.7/site-packages/dnf/cli/main.py", line 242, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 75, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 124, in _main
    cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1378, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python2.7/site-packages/dnf/cli/commands/__init__.py", line 403, in run
    dnf.pycomp.unicode(pkg_spec))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Version-Release number of selected component:
dnf-0.4.20-1.fc20

Additional info:
reporter:       libreport-2.2.2
cmdline:        /usr/bin/python /usr/bin/dnf upgrade -y '\xd0\xb4\xd1\x88\xd0\xb8*'
executable:     /usr/bin/dnf
kernel:         3.14.1-200.fc20.x86_64
runlevel:       N 5
type:           Python
uid:            0

Truncated backtrace:
__init__.py:403:run:UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

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/python2.7/site-packages/dnf/cli/main.py", line 242, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 75, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 124, in _main
    cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1378, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python2.7/site-packages/dnf/cli/commands/__init__.py", line 403, in run
    dnf.pycomp.unicode(pkg_spec))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Local variables in innermost frame:
pkg_specs: ['\xd0\xb4\xd1\x88\xd0\xb8*']
extcmds: ['\xd0\xb4\xd1\x88\xd0\xb8*']
results: []
done: False
pkg_spec: '\xd0\xb4\xd1\x88\xd0\xb8*'
filenames: []
self: <dnf.cli.commands.UpgradeCommand object at 0x260f250>
Comment 1 Pavel Roskin 2014-04-29 21:18:36 EDT
Created attachment 890974 [details]
File: backtrace
Comment 2 Pavel Roskin 2014-04-29 21:18:38 EDT
Created attachment 890975 [details]
File: environ
Comment 3 Pavel Roskin 2014-04-29 21:22:58 EDT
dnf should not assume that anything on the command line is in plain ASCII.  It may or may not be.  I can imagine some distros may actually want to have non-ASCII characters in the package names.
Comment 4 Ales Kozumplik 2014-04-30 00:55:22 EDT
Thanks for reporting.

Moving to Jan.
Comment 5 Didier G 2014-05-07 03:17:35 EDT
Same problem on a system using french language.

I dont know if it matters but by default on system using french language, download directory is called in "Téléchargements"
Comment 6 Didier G 2014-05-07 03:18:31 EDT
Created attachment 893128 [details]
Error messages
Comment 7 Pavel Roskin 2014-05-07 10:33:20 EDT
(In reply to Didier G from comment #6)
Actually, it's an error in a different part of code, but it's the same error conceptually. Text is wrongly assumed to be in ASCII.

I see a lot of Unicode related work in the git log for dnf before the 0.5.1 release: https://github.com/akozumpl/dnf/commits/master

Perhaps dnf could be updated to the latest version?  It's still an experimental package manager in Fedora.  People who install it want to test it and it's pointless to test an old release.
Comment 8 Tim Lauridsen 2014-05-07 10:53:04 EDT
0.5.1 is in updates-testing

sudo dnf update dnf --enablerepo=updates-testing
Comment 9 Didier G 2014-05-07 20:31:06 EDT
Error in comment #6 occured with dnf-0.5.1-1.fc20.noarch
Comment 10 Pavel Roskin 2014-05-08 00:18:23 EDT
The original bug is also reproducible with dnf 0.5.1.
Comment 11 Peter Borsa 2014-05-25 14:05:03 EDT
I can reproduce this issue with dnf-0.5.1-1.

I tried to list "php-" packages, got some packages and this:

"Traceback (most recent call last):
  File "/bin/dnf", line 36, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 206, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 82, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 132, in _main
    cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1164, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python2.7/site-packages/dnf/cli/commands/__init__.py", line 515, in run
    return self.cli.search(extcmds)
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1225, in search
    args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/output.py", line 1089, in matchcallback
    msg = self.fmtKeyValFill(msg, unicode(po.summary) or "")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 16: ordinal not in range(128)"
Comment 12 Honza Silhan 2014-05-26 08:05:59 EDT
Fixed in the upstream.
Comment 13 Fedora Update System 2014-05-28 08:09:00 EDT
dnf-plugins-core-0.0.8-2.fc20, libsolv-0.6.1-1.git6d968f1.fc20, hawkey-0.4.16-1.fc20, dnf-0.5.2-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/libsolv-0.6.1-1.git6d968f1.fc20,hawkey-0.4.16-1.fc20,dnf-0.5.2-1.fc20,dnf-plugins-core-0.0.8-2.fc20
Comment 14 Fedora Update System 2014-05-28 08:11:27 EDT
dnf-plugins-core-0.0.8-2.fc20, libsolv-0.6.1-1.git6d968f1.fc20, hawkey-0.4.16-1.fc20, dnf-0.5.2-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/libsolv-0.6.1-1.git6d968f1.fc20,hawkey-0.4.16-1.fc20,dnf-0.5.2-1.fc20,dnf-plugins-core-0.0.8-2.fc20
Comment 15 Fedora Update System 2014-05-28 19:48:53 EDT
Package dnf-plugins-core-0.0.8-2.fc20, libsolv-0.6.1-1.git6d968f1.fc20, hawkey-0.4.16-1.fc20, dnf-0.5.2-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-plugins-core-0.0.8-2.fc20 libsolv-0.6.1-1.git6d968f1.fc20 hawkey-0.4.16-1.fc20 dnf-0.5.2-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-6789/libsolv-0.6.1-1.git6d968f1.fc20,hawkey-0.4.16-1.fc20,dnf-0.5.2-1.fc20,dnf-plugins-core-0.0.8-2.fc20
then log in and leave karma (feedback).
Comment 16 Pavel Roskin 2014-05-31 01:14:43 EDT
The problems is fixed in 0.5.2, but not in the C locale:

# LANG=C dnf upgrade -y дши*
Traceback (most recent call last):
  File "/usr/bin/dnf", line 36, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 206, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 82, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 111, in _main
    cli.configure(map(ucd, args))
  File "/usr/lib/python2.7/site-packages/dnf/i18n.py", line 129, in ucd
    return unicode(str(obj), _guess_encoding())
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Should I file a new bug?

The problem from comment #6 appears to be fixed in all locales.

I cannot reproduce the problem from comment 11 with dnf 0.4.20-1.fc20 and 0.5.2-1.fc20.  That should be a separate bug with the corresponding data (unless it's fixed).
Comment 17 Fedora Update System 2014-05-31 19:57:26 EDT
dnf-plugins-core-0.0.8-2.fc20, libsolv-0.6.1-1.git6d968f1.fc20, hawkey-0.4.16-1.fc20, dnf-0.5.2-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

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