Bug 1063022 - [abrt] dnf: i18n.py:38:write:UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 12: ordinal not in range(128)
Summary: [abrt] dnf: i18n.py:38:write:UnicodeEncodeError: 'ascii' codec can't encode c...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 20
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Radek Holy
QA Contact: Fedora Extras Quality Assurance
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:16254b5e43f6c5a2fdb827edc5c...
: 1064083 1066648 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-09 16:42 UTC by Dandim
Modified: 2015-10-06 02:14 UTC (History)
7 users (show)

Fixed In Version: dnf-0.4.14-1.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-02-17 21:03:15 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: backtrace (1.37 KB, text/plain)
2014-02-09 16:42 UTC, Dandim
no flags Details
File: environ (1.72 KB, text/plain)
2014-02-09 16:42 UTC, Dandim
no flags Details

Description Dandim 2014-02-09 16:42:00 UTC
Description of problem:
Crash DNF when i type to terminal "sudo yum install gnome-wea" and type TAB key to completion command.

Version-Release number of selected component:
dnf-0.4.13-2.fc20

Additional info:
reporter:       libreport-2.1.12
cmdline:        /usr/bin/python /usr/bin/dnf list --cacheonly
executable:     /usr/bin/dnf
kernel:         3.12.10-300.fc20.x86_64
runlevel:       N 5
type:           Python
uid:            0

Truncated backtrace:
i18n.py:38:write:UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 12: 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 64, 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 1454, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python2.7/site-packages/dnf/cli/commands.py", line 567, in run
    return self._run('list', extcmds)
  File "/usr/lib/python2.7/site-packages/dnf/cli/commands.py", line 509, in _run
    '=' : clir, 'not in' : clie})
  File "/usr/lib/python2.7/site-packages/dnf/cli/output.py", line 919, in listPkgs
    print('%s' % description)
  File "/usr/lib/python2.7/site-packages/dnf/i18n.py", line 38, in write
    self.stream.write(s.decode(self.encoding, 'replace'))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 12: ordinal not in range(128)

Local variables in innermost frame:
s: 'Nainstalovan\xc3\xa9 bal\xc3\xad\xc4\x8dky:'
self: <dnf.i18n.UnicodeStream object at 0x221c690>

Comment 1 Dandim 2014-02-09 16:42:05 UTC
Created attachment 861078 [details]
File: backtrace

Comment 2 Dandim 2014-02-09 16:42:08 UTC
Created attachment 861079 [details]
File: environ

Comment 3 Radek Holy 2014-02-12 07:46:00 UTC
*** Bug 1064083 has been marked as a duplicate of this bug. ***

Comment 4 Radek Holy 2014-02-12 07:48:13 UTC
Hello, thank you for the report. I will take a look at it.

Comment 5 Heldwin 2014-02-12 17:52:46 UTC
If I revert the change in the i18n.py at line 38:

-        self.stream.write(s)
+        self.stream.write(s.decode(self.encoding, 'replace'))

I don't get the traceback anymore:
Feb 12 18:42:20 rodin-666 dnf: Config time: 0.008
Feb 12 18:42:20 rodin-666 dnf: cachedir: /var/cache/dnf/x86_64/20
Feb 12 18:42:20 rodin-666 dnf: dnf version: 0.4.13
Feb 12 18:42:20 rodin-666 dnf: Création des fichiers de cache pour tous les fichiers de méta données.
Feb 12 18:42:20 rodin-666 dnf: Metadata cache refreshed recently.
Feb 12 18:42:20 rodin-666 systemd: Started dnf makecache.

With the commit:
Feb 12 18:45:59 rodin-666 systemd: Starting dnf makecache...
Feb 12 18:45:59 rodin-666 dnf: Config time: 0.008
Feb 12 18:45:59 rodin-666 dnf: cachedir: /var/cache/dnf/x86_64/20
Feb 12 18:45:59 rodin-666 dnf: dnf version: 0.4.13
Feb 12 18:45:59 rodin-666 dnf: Traceback (most recent call last):
Feb 12 18:45:59 rodin-666 dnf: File "/usr/lib64/python2.7/logging/__init__.py", line 874, in emit
Feb 12 18:45:59 rodin-666 dnf: stream.write(fs % msg.encode("UTF-8"))
Feb 12 18:45:59 rodin-666 dnf: File "/usr/lib/python2.7/site-packages/dnf/i18n.py", line 38, in write
Feb 12 18:45:59 rodin-666 dnf: self.stream.write(s.decode(self.encoding, 'replace'))
Feb 12 18:45:59 rodin-666 dnf: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 2: ordinal not in range(128)
Feb 12 18:45:59 rodin-666 dnf: Logged from file commands.py, line 760
Feb 12 18:45:59 rodin-666 dnf: Metadata cache refreshed recently.
Feb 12 18:45:59 rodin-666 systemd: Started dnf makecache.

So it seems the traceback blocks when 's' is:
"Création des fichiers de cache pour tous les fichiers de méta données."


But I don't have a problem the reporter of the bug has:
sudo yum install gnome-wea[TAB] , completes correctly
sudo dnf install gnome-wea[TAB] , just does not complete

Comment 6 Heldwin 2014-02-12 18:14:26 UTC
really don't know if that can help, but with:

+        if isinstance(s, unicode):
            self.stream.write(s.decode(self.encoding, 'replace'))
+        else:
+           self.stream.write(s)

it doesn't do the traceback, so it seems to go to the "else" at this point.

Comment 7 Radek Holy 2014-02-13 08:00:05 UTC
The reproducibility depends on which encoding uses the stdout stream.

Fixed upstream by 4c996e8f10300cde868eb74f187b85edf51a5ec8.

Comment 8 Fedora Update System 2014-02-13 08:26:10 UTC
dnf-0.4.14-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/dnf-0.4.14-1.fc20

Comment 9 Heldwin 2014-02-13 21:34:22 UTC
This update solves this issue for me, thanks

Comment 10 Fedora Update System 2014-02-14 07:57:10 UTC
Package dnf-0.4.14-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-0.4.14-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-2471/dnf-0.4.14-1.fc20
then log in and leave karma (feedback).

Comment 11 Dandim 2014-02-15 15:59:47 UTC
Bug looks fixed in new version. Karma it. Thanks.

Comment 12 Fedora Update System 2014-02-17 21:03:15 UTC
dnf-0.4.14-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Radek Holy 2014-02-19 07:38:52 UTC
*** Bug 1066648 has been marked as a duplicate of this bug. ***


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