Description of problem:
When trying to do a history list with user names rather than command lines I get a UnicodeDecodeError exception. Some experimentation led me to the conclusion that is because of non-ascii letters in my login and full names.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. LANG=en_US.utf8 dnf --setopt=history_list_view=users history
ID | Login user | Date a | Action | Altere
Traceback (most recent call last):
File "/usr/bin/dnf", line 36, in <module>
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
File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1163, in run
File "/usr/lib/python2.7/site-packages/dnf/cli/commands/__init__.py", line 1530, in run
ret = self.output.historyListCmd(extcmds)
File "/usr/lib/python2.7/site-packages/dnf/cli/output.py", line 1668, in historyListCmd
name = self._pwd_ui_username(old.loginuid, 24)
File "/usr/lib/python2.7/site-packages/dnf/cli/output.py", line 1513, in _pwd_ui_username
fullname = _safe_split_0(user.pw_gecos, ';', 2)
File "/usr/lib/python2.7/site-packages/dnf/cli/output.py", line 1506, in _safe_split_0
ret = text.split(*args)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)
A history list with my name in most of the transactions.
Both my login id and my full name contain non-ascii letters. Having a non-ascii login id might be stretching the the standards a bit. But having a non ascii full name (gecos) must be considered quite normal.
I made the following patch which seems to work around the problem:
--- output.py.orig 2014-05-28 10:27:24.000000000 +0200
+++ output.py 2014-07-18 22:49:55.000000000 +0200
@@ -1510,8 +1510,8 @@
user = pwd.getpwuid(uid)
- fullname = _safe_split_0(user.pw_gecos, ';', 2)
- name = "%s <%s>" % (fullname, user.pw_name)
+ fullname = _safe_split_0(ucd(user.pw_gecos), ';', 2)
+ name = "%s <%s>" % (fullname, ucd(user.pw_name))
if limit is not None and len(name) > limit:
name = "%s ... <%s>" % (_safe_split_0(fullname), user.pw_name)
if len(name) > limit:
If this is the right thing to do, I don't know. Encodings in Python are a mystery to me!
Bug 1108908, on its way to be fixed, concerns another unicode issue in dnf.
Fixed in the upstream.
dnf-0.5.4-2.fc20 has been submitted as an update for Fedora 20.
* 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.5.4-2.fc20'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
dnf-0.5.4-2.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.