Bug 1223034 - [abrt] python-dnf: pycomp.py:88:write_to_file:UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 24: ordinal not in range(128)
[abrt] python-dnf: pycomp.py:88:write_to_file:UnicodeDecodeError: 'ascii' cod...
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf-plugins-extras (Show other bugs)
22
x86_64 Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Radek Holy
Fedora Extras Quality Assurance
https://retrace.fedoraproject.org/faf...
abrt_hash:39a98c03c1ff61eb6e01b1f7f1f...
:
: 1224049 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-05-19 12:09 EDT by Farid
Modified: 2015-10-05 22:14 EDT (History)
12 users (show)

See Also:
Fixed In Version: dnf-plugins-extras-0.0.8-1.fc22
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-05-30 11:56:38 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.63 KB, text/plain)
2015-05-19 12:09 EDT, Farid
no flags Details
File: environ (2.57 KB, text/plain)
2015-05-19 12:09 EDT, Farid
no flags Details

  None (edit)
Description Farid 2015-05-19 12:09:42 EDT
Description of problem:
dnf migrate

Version-Release number of selected component:
python-dnf-1.0.0-1.fc22

Additional info:
reporter:       libreport-2.5.1
cmdline:        /usr/bin/python -OO /bin/dnf-2 migrate
dso_list:       python-dnf-plugins-extras-migrate-0.0.7-1.fc22.noarch
executable:     /bin/dnf-2
kernel:         4.0.2-300.fc22.x86_64
runlevel:       N 5
type:           Python
uid:            0

Truncated backtrace:
pycomp.py:88:write_to_file:UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 24: ordinal not in range(128)

Traceback (most recent call last):
  File "/bin/dnf-2", 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 185, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 84, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 134, in _main
    cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1077, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python2.7/site-packages/dnf-plugins/migrate.py", line 123, in run
    self.migrate_yumdb()
  File "/usr/lib/python2.7/site-packages/dnf-plugins/migrate.py", line 289, in migrate_yumdb
    setattr(dnfdata, attribute, value)
  File "/usr/lib/python2.7/site-packages/dnf/yum/rpmsack.py", line 295, in __setattr__
    self._write(attr, value)
  File "/usr/lib/python2.7/site-packages/dnf/yum/rpmsack.py", line 232, in _write
    dnf.pycomp.write_to_file(fo, value)
  File "/usr/lib/python2.7/site-packages/dnf/pycomp.py", line 88, in write_to_file
    f.write(content.encode('utf-8'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 24: ordinal not in range(128)

Local variables in innermost frame:
content: '-y install /home/smael/T\xc3\xa9l\xc3\xa9chargements/skype-4.3.0.37-fedora.i586.rpm'
f: <open file u'/var/lib/dnf/yumdb/t/f454a7a23f9b3e664fe07ac7de22123369c2cbf4-tcp_wrappers-libs-7.6-76.fc20-i686/command_line.tmp', mode 'w' at 0x7fb788f9f780>
Comment 1 Farid 2015-05-19 12:09:46 EDT
Created attachment 1027298 [details]
File: backtrace
Comment 2 Farid 2015-05-19 12:09:47 EDT
Created attachment 1027299 [details]
File: environ
Comment 3 Farid 2015-05-19 12:10:19 EDT
Another user experienced a similar problem:

dnf migrate

reporter:       libreport-2.5.1
cmdline:        /usr/bin/python -OO /bin/dnf migrate
event_log:      2015-05-19-18:09:59> (« report_uReport » terminé avec succès)
executable:     /bin/dnf
kernel:         4.0.2-300.fc22.x86_64
package:        dnf-1.0.0-1.fc22
reason:         pycomp.py:88:write_to_file:UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 24: ordinal not in range(128)
runlevel:       N 5
type:           Python
uid:            0
Comment 4 Radek Holy 2015-05-20 08:35:43 EDT
Thank you for the report.

The `dnf.pycomp.write_to_file` function is apparently broken. It does not work for non-ascii byte strings.

On the other hand, to be safe, I think that the migrate plugin should convert all the byte strings to Unicode strings. That would improve the plugin as well as work around the problem with `write_to_file`.

We'll take a look.
Comment 5 Radek Holy 2015-05-20 08:41:46 EDT
Let's improve the wording: "as a side effect, it would work around the problem with `write_to_file` as well."
Comment 6 Radek Holy 2015-05-22 03:31:30 EDT
It apparently affects a lot of people, taking...
Comment 8 Fedora Update System 2015-05-22 13:26:32 EDT
dnf-plugins-extras-0.0.8-1.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/dnf-plugins-extras-0.0.8-1.fc22
Comment 9 Fedora Update System 2015-05-25 23:14:59 EDT
Package dnf-plugins-extras-0.0.8-1.fc22:
* should fix your issue,
* was pushed to the Fedora 22 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-plugins-extras-0.0.8-1.fc22'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-8740/dnf-plugins-extras-0.0.8-1.fc22
then log in and leave karma (feedback).
Comment 10 Fedora Update System 2015-05-30 11:56:38 EDT
dnf-plugins-extras-0.0.8-1.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 11 Honza Silhan 2015-07-22 09:19:20 EDT
*** Bug 1224049 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.