Bug 1092777 - [abrt] dnf: __init__.py:403:run:UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
Summary: [abrt] dnf: __init__.py:403:run:UnicodeDecodeError: 'ascii' codec can't decod...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 20
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Honza Silhan
QA Contact: Fedora Extras Quality Assurance
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:4d6313c9d98044730de9371f36c...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-30 01:18 UTC by Pavel Roskin
Modified: 2014-05-31 23:57 UTC (History)
6 users (show)

Fixed In Version: dnf-plugins-core-0.0.8-2.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-05-31 23:57:26 UTC
Type: ---
Embargoed:


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

Description Pavel Roskin 2014-04-30 01:18:31 UTC
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-30 01:18:36 UTC
Created attachment 890974 [details]
File: backtrace

Comment 2 Pavel Roskin 2014-04-30 01:18:38 UTC
Created attachment 890975 [details]
File: environ

Comment 3 Pavel Roskin 2014-04-30 01:22:58 UTC
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 04:55:22 UTC
Thanks for reporting.

Moving to Jan.

Comment 5 Didier G 2014-05-07 07:17:35 UTC
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 07:18:31 UTC
Created attachment 893128 [details]
Error messages

Comment 7 Pavel Roskin 2014-05-07 14:33:20 UTC
(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 14:53:04 UTC
0.5.1 is in updates-testing

sudo dnf update dnf --enablerepo=updates-testing

Comment 9 Didier G 2014-05-08 00:31:06 UTC
Error in comment #6 occured with dnf-0.5.1-1.fc20.noarch

Comment 10 Pavel Roskin 2014-05-08 04:18:23 UTC
The original bug is also reproducible with dnf 0.5.1.

Comment 11 Peter Borsa 2014-05-25 18:05:03 UTC
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 12:05:59 UTC
Fixed in the upstream.

Comment 13 Fedora Update System 2014-05-28 12:09:00 UTC
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 12:11:27 UTC
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 23:48:53 UTC
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 05:14:43 UTC
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 23:57:26 UTC
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.