Bug 1308994 - After installing a package from local unicode directory a traceback is shown (UnicodeEncodeError)
After installing a package from local unicode directory a traceback is shown ...
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
23
Unspecified Unspecified
low Severity unspecified
: ---
: ---
Assigned To: Jaroslav Mracek
Fedora Extras Quality Assurance
: i18n, Reopened, Triaged
: 1312021 (view as bug list)
Depends On:
Blocks: 1368340
  Show dependency treegraph
 
Reported: 2016-02-16 11:44 EST by Miro Hrončok
Modified: 2016-08-27 06:22 EDT (History)
7 users (show)

See Also:
Fixed In Version: dnf-1.1.10-1.fc24 dnf-1.1.10-1.fc23 dnf-1.1.10-1.fc25
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1368340 (view as bug list)
Environment:
Last Closed: 2016-08-19 15:51:54 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Full terminal output and traceback (4.97 KB, text/plain)
2016-02-16 11:44 EST, Miro Hrončok
no flags Details

  None (edit)
Description Miro Hrončok 2016-02-16 11:44:11 EST
Created attachment 1127634 [details]
Full terminal output and traceback

Description of problem:
I have my locales set to cs_CZ.utf8. When I download some files, they end up in ~/Stažené which means ~/Downloads

When I install downloaded packages, I do something like:

    # dnf install ./Stažené/nosync-1.0-3.fc23.i686.rpm

The installation works fine, but after the installation, a traceback is shown.

Version-Release number of selected component (if applicable):
dnf-1.1.6-2.fc23.noarch

How reproducible:
Only when some dependent packages are installed as well.

Steps to Reproduce:
1. Download an rpm, I've used i686 of nosync http://koji.fedoraproject.org/koji/buildinfo?buildID=724570
2. Place that RPM to ~/Stažené
3. Make sure dependencies are not already satisfied (e.g. for nosync make sure glibc.i686 is missing)
4. dnf install ./Stažené/nosync-1.0-3.fc23.i686.rpm

Actual results:
Package installs fine, brings some deps.
Traceback is shown after "You can remove cached packages by executing 'dnf clean packages'." message is shown.


Expected results:
Package installs fine, brings some deps.
No tracebacks.

Additional info:

Full terminal output and traceback attached.

You are writing Unicode data (the command I put on command line) to this object:

    <_io.TextIOWrapper name='/var/lib/dnf/yumdb/n/[longhash]-nosync-1.0-3.fc23-i686/command_line.tmp' mode='w' encoding='ANSI_X3.4-1968'>

And it blows up. I was unable to reproduce this from Python 3 shell, because if I do (as you do):

    fo = dnf.yum.rpmsack._open_no_umask(fn + '.tmp', 'w')

fo is <_io.TextIOWrapper name='...tmp' mode='w' encoding='UTF-8'>

At this point, my investigation ends. No idea, why your _io.TextIOWrappers are ANSI_X3.4-1968.
Comment 1 Honza Silhan 2016-02-22 07:33:13 EST
thanks for the report. We'll fix this.
Comment 2 Miro Hrončok 2016-02-25 09:31:03 EST
*** Bug 1312021 has been marked as a duplicate of this bug. ***
Comment 3 Fedora Admin XMLRPC Client 2016-07-08 05:39:26 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 4 Jaroslav Mracek 2016-07-28 04:05:52 EDT
The patch is here and is waiting for review: https://github.com/rpm-software-management/dnf/pull/550
Comment 5 Igor Gnatenko 2016-07-29 10:56:43 EDT
Merged as part of DNF 2.0 release.
Comment 6 Michael Mráka 2016-08-02 07:30:27 EDT
# ./bin/dnf-2 install ekiga
Dependencies resolved.
================================================================================
 Package                   Arch     Version                     Repository
                                                                           Size
================================================================================
Installing:
 ekiga                     x86_64   4.0.1-23.fc23               fedora    8.1 M
Installing dependencies:
...
Is this ok [y/N]: y
Downloading Packages:
...
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Traceback (most recent call last):
  File "./bin/dnf-2", line 58, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/root/dnf.git/dnf/cli/main.py", line 170, in user_main
    errcode = main(args)
  File "/root/dnf.git/dnf/cli/main.py", line 60, in main
    return _main(base, args)
  File "/root/dnf.git/dnf/cli/main.py", line 119, in _main
    ret = resolving(cli, base)
  File "/root/dnf.git/dnf/cli/main.py", line 146, in resolving
    base.do_transaction(display=displays)
  File "/root/dnf.git/dnf/cli/cli.py", line 221, in do_transaction
    super(BaseCli, self).do_transaction(display)
  File "/root/dnf.git/dnf/base.py", line 639, in do_transaction
    self._run_transaction(cb=cb)
  File "/root/dnf.git/dnf/base.py", line 685, in _run_transaction
    rpmdbv = self.sack._rpmdb_version(self._yumdb)
  File "/root/dnf.git/dnf/sack.py", line 90, in _rpmdb_version
    if 'checksum_type' in ydbi and 'checksum_data' in ydbi:
  File "/root/dnf.git/dnf/yum/rpmsack.py", line 311, in __contains__
    x = self.get(attr)
  File "/root/dnf.git/dnf/yum/rpmsack.py", line 338, in get
    res = self._read(attr)
  File "/root/dnf.git/dnf/yum/rpmsack.py", line 265, in _read
    fo, e = _iopen(fn)
  File "/root/dnf.git/dnf/yum/rpmsack.py", line 59, in _iopen
    ret = open(*args, encoding='utf-8')
TypeError: 'encoding' is an invalid keyword argument for this function

# git log dnf/yum/rpmsack.py
commit 63ab30c520d9fb7d83496f3616e454c363d4bacc
Author: Jaroslav Mracek <jmracek@redhat.com>
Date:   Thu Jul 28 09:54:42 2016 +0200

    Fix handling with unicode directory (RhBug:1308994)
    
    It fixes handling of local rpm from unicode directory.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1308994
    
    Closes: #550
    Approved by: ignatenkobrain
Comment 7 Igor Gnatenko 2016-08-02 07:34:28 EDT
Uh oh, py2.
Comment 8 Jaroslav Mracek 2016-08-02 08:06:57 EDT
I will make fix for fix. Sorry forget py2.
Comment 9 Jaroslav Mracek 2016-08-02 09:32:19 EDT
I create new pull-request that hopefully fix the problem: https://github.com/rpm-software-management/dnf/pull/555
Comment 10 Miro Hrončok 2016-08-02 18:39:44 EDT
Also, this was reported against Fedora 23. Could you please backport the fix?
Comment 11 Fedora Update System 2016-08-18 11:19:41 EDT
dnf-1.1.10-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-267f843cda
Comment 12 Fedora Update System 2016-08-18 11:20:53 EDT
dnf-1.1.10-1.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-8caa619a9e
Comment 13 Fedora Update System 2016-08-18 11:21:54 EDT
dnf-1.1.10-1.fc24 dnf-plugins-core-0.1.21-3.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-878284e0d3
Comment 14 Fedora Update System 2016-08-18 12:53:06 EDT
dnf-1.1.10-1.fc25, dnf-plugins-core-0.1.21-4.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-8caa619a9e
Comment 15 Fedora Update System 2016-08-18 20:22:50 EDT
dnf-1.1.10-1.fc23, dnf-plugins-core-0.1.21-3.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-267f843cda
Comment 16 Fedora Update System 2016-08-18 20:58:01 EDT
dnf-1.1.10-1.fc24, dnf-plugins-core-0.1.21-3.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-878284e0d3
Comment 17 Fedora Update System 2016-08-19 15:50:56 EDT
dnf-1.1.10-1.fc24, dnf-plugins-core-0.1.21-3.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.
Comment 18 Fedora Update System 2016-08-23 11:20:04 EDT
dnf-1.1.10-1.fc23, dnf-plugins-core-0.1.21-3.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
Comment 19 Fedora Update System 2016-08-27 06:21:06 EDT
dnf-1.1.10-1.fc25, dnf-plugins-core-0.1.21-4.fc25 has been pushed to the Fedora 25 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.