Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1246928 - dnf: AttributeError: 'NoneType' object has no attribute 'encode'
Summary: dnf: AttributeError: 'NoneType' object has no attribute 'encode'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michael Mráka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-07-27 00:34 UTC by Mikolaj Izdebski
Modified: 2015-10-13 06:52 UTC (History)
9 users (show)

Fixed In Version: dnf-plugins-core-0.1.10-1.fc23 dnf-0.6.4-7.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-10-13 06:52:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Mikolaj Izdebski 2015-07-27 00:34:34 UTC
Description of problem:
dnf crashes when trying to install packages without releasever set.
Related to bug #1117293 and bug #1173107.

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

Steps to Reproduce:
dnf -y --installroot /chroot --setopt reposdir=/dev/null --repofrompath main,http://kojipkgs.fedoraproject.org/repos/rawhide/latest/x86_64/ install setup

Actual results:
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 190, 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 146, in _main
    ret = resolving(cli, base)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 165, in resolving
    base.do_transaction(display=cli.demands.transaction_display)
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 219, in do_transaction
    super(BaseCli, self).do_transaction(display)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 595, in do_transaction
    self._run_transaction(cb=cb)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 717, in _run_transaction
    self.verify_transaction(cb.verify_tsi_package)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 774, in verify_transaction
    yumdb_info.releasever = self.conf.releasever
  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 91, in write_to_file
    f.write(content.encode('utf-8'))
AttributeError: 'NoneType' object has no attribute 'encode'

Additional info:
Adding --releasever 24 prevents the crash from happening.

Comment 1 Honza Silhan 2015-08-10 14:49:30 UTC
Michael, do you know where the problem is? Should this work with releasever refactoring?

Comment 2 Michael Mráka 2015-08-11 12:24:27 UTC
Yep, it's caused by recent releasever change.

Fixed in
commit 58e71340c4f006893bc59f15bbb88f10b23f4098
    don't store empty attributes (RhBug:1246928)

Comment 3 Fedora Update System 2015-08-13 08:17:03 UTC
dnf-plugins-core-0.1.10-1.fc22, hawkey-0.6.0-1.fc22, dnf-1.1.0-2.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/FEDORA-2015-13162/dnf-plugins-core-0.1.10-1.fc22,dnf-1.1.0-2.fc22,hawkey-0.6.0-1.fc22

Comment 4 Fedora Update System 2015-08-13 08:17:10 UTC
dnf-plugins-core-0.1.10-1.fc23, hawkey-0.6.0-1.fc23, dnf-1.1.0-2.fc23 has been submitted as an update for Fedora 23.
https://admin.fedoraproject.org/updates/FEDORA-2015-13289/dnf-plugins-core-0.1.10-1.fc23,dnf-1.1.0-2.fc23,hawkey-0.6.0-1.fc23

Comment 5 Fedora Update System 2015-08-13 16:55:09 UTC
Package dnf-plugins-core-0.1.10-1.fc22, hawkey-0.6.0-1.fc22, dnf-1.1.0-2.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-core-0.1.10-1.fc22 hawkey-0.6.0-1.fc22 dnf-1.1.0-2.fc22'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-13162/dnf-plugins-core-0.1.10-1.fc22,dnf-1.1.0-2.fc22,hawkey-0.6.0-1.fc22
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2015-08-15 02:13:53 UTC
dnf-plugins-core-0.1.10-1.fc22, hawkey-0.6.0-1.fc22, dnf-1.1.0-2.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2015-08-19 07:51:42 UTC
dnf-plugins-core-0.1.10-1.fc23, hawkey-0.6.0-1.fc23, dnf-1.1.0-2.fc23 has been pushed to the Fedora 23 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Dennis Gilmore 2015-09-06 22:28:11 UTC
We need this fix backported to f21 to enable us to turn on dnf for making rawhide buildroots see the buildlog for http://koji.fedoraproject.org/koji/taskinfo?taskID=10981031

Comment 9 Radek Holy 2015-09-07 09:24:12 UTC
Since you did it several times... Is this how it works in Fedora? I mean, if someone files a bug against Fedora 22 and if we fix it in Fedora 22, is it correct to reopen the bug later in order to get the fix backported to older Fedoras? Is it documented somewhere? Or is it a common practice?

Comment 10 Dennis Gilmore 2015-09-07 16:10:08 UTC
We can not move the builders to Fedora 22 until we are sure that everything will work correctly with the change to dnf taking over yum on the system, and to ensure that we can use dnf to create buildroots in the system.  it is common practice to reopen a bug if you hit the same issue on a different release. If you prefer I can try to remeber to open a new bug, or to clone the bug, normally we just reopen them though.

Comment 11 Dennis Gilmore 2015-09-22 22:00:55 UTC
Ping, we need this update fairly urgently

Comment 12 Radek Holy 2015-09-22 22:11:24 UTC
I made sure my team mates will take a look.

Comment 13 Honza Silhan 2015-09-23 11:18:39 UTC
Added to sprint. We'll backport it in the new f21 release of DNF.

Comment 14 Fedora Update System 2015-09-29 11:18:35 UTC
dnf-0.6.4-7.fc21 has been submitted as an update to Fedora 21. https://bodhi.fedoraproject.org/updates/FEDORA-2015-9bcdcdc46b

Comment 15 Michal Luscon 2015-09-29 11:34:48 UTC
I am sorry for a delay, but bodhi silently refused this update and I did not notice it.

Comment 16 Fedora Update System 2015-10-02 18:51:56 UTC
dnf-0.6.4-7.fc21 has been pushed to the Fedora 21 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update dnf'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-9bcdcdc46b

Comment 17 Fedora Update System 2015-10-13 06:51:56 UTC
dnf-0.6.4-7.fc21 has been pushed to the Fedora 21 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.