Bug 1289166 - dnf makecache triggers a python exception
dnf makecache triggers a python exception
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
23
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: packaging-team-maint
Fedora Extras Quality Assurance
: Reopened
: 1289449 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-12-07 10:06 EST by Michael S. Tsirkin
Modified: 2016-02-16 23:23 EST (History)
8 users (show)

See Also:
Fixed In Version: dnf-1.1.6-1.fc23 dnf-1.1.6-2.fc22
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-02-16 23:23:18 EST
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)

  None (edit)
Description Michael S. Tsirkin 2015-12-07 10:06:49 EST
Description of problem:
ever since I upgraded to Fedora 23,
dnf makecache crashes.

My dnf.conf:
[mst@robin ~]$ cat /etc/dnf/dnf.conf 
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=true
metadata_expire=never
metadata_timer_sync=0

Applying the below patch helps.

$ diff -u makecache.py /usr/lib/python3.4/site-packages/dnf/cli/commands/makecache.py
--- makecache.py        2015-12-07 17:05:01.751919279 +0200
+++ /usr/lib/python3.4/site-packages/dnf/cli/commands/makecache.py      2015-12-07 17:05:05.282858626 +0200
@@ -69,7 +69,7 @@
 
         for r in self.base.repos.iter_enabled():
             (is_cache, expires_in) = r.metadata_expire_in()
-            if not is_cache or expires_in <= 0:
+            if not is_cache or expires_in == None or expires_in <= 0:
                 logger.debug('%s: has expired and will be refreshed.', r.id)
                 r.md_expire_cache()
             elif timer and expires_in < period:


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

How reproducible:
always

Steps to Reproduce:
1. sudo dnf makecache

Actual results:
$ dnf makecache
Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 174, in user_main
    errcode = main(args)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 60, in main
    return _main(base, args)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 112, in _main
    cli.run()
  File "/usr/lib/python3.4/site-packages/dnf/cli/cli.py", line 1091, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/makecache.py", line 72, in run
    if not is_cache or expires_in <= 0:
TypeError: unorderable types: NoneType() <= int()


Expected results:
should create a cache

Additional info:
Comment 1 Michael S. Tsirkin 2015-12-07 10:07:30 EST
I'm pretty sure this is something in my setup.
Just could not figure out what it is.
Comment 2 Jaroslav Mracek 2015-12-08 09:08:42 EST
Thank you for report, we will look at it
Comment 3 Jaroslav Mracek 2015-12-08 09:09:59 EST
*** Bug 1289449 has been marked as a duplicate of this bug. ***
Comment 4 Jaroslav Mracek 2015-12-10 09:47:56 EST
I am sorry but we cannot reproduce it. Please could you provide condition or settings that will trigger the error. On virtual machine with upgraded f22 to f23 (standard settings) we were unable to reproduce it even with yours dnf.conf setting.
Comment 5 Michael S. Tsirkin 2015-12-10 14:05:54 EST
I'm not sure what you are looking for.
this must be some configuration file.

It's 100% reproducible so can't you write a patch to add
some print statements in main.py and cli.py
to see where does expires_in come from?
I'll gladly apply it and give you the result.

It's not surprising this does not trigger
on a fresh install, this machine has been
updated over time all the way from probably f18
and some config files have been manually
tweaked in between.

Could be yum.conf?

$ cat /etc/yum.conf 
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3
http_caching=none

arch=i686
basearch=i386

mdpolicy=group:all
mddownloadpolicy=sqlite
metadata_expire_filter=read-only:future
metadata_expire=never
#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
Comment 6 Petr Pisar 2015-12-11 03:23:30 EST
I haven't tried it in fresh new installation, but I can reproduced in any installation (F23 or F24) I have by these steps:

(1) Add metadata_expire=never into main section of /etc/dnf/dnf.conf.
(2) Remove metadata_expire=6h from an enabled repository.
(3) Run "dnf clean metadata"
(4) Run "dnf makecache". This succeeds.
(5) Run "dnf makecache" again. This fails with the backtrace.
Comment 7 Honza Silhan 2015-12-14 07:43:05 EST
Pert, thanks for reproducer, we will take a look.
Comment 8 Jaroslav Mracek 2016-01-05 04:41:46 EST
The new pull-request was made (https://github.com/rpm-software-management/dnf/pull/420) that should fix the problem.
Comment 9 Fedora Update System 2016-01-26 05:34:41 EST
dnf-plugins-core-0.1.16-1.fc23 dnf-1.1.6-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-80cbf309b4
Comment 10 Fedora Update System 2016-01-26 05:35:53 EST
dnf-plugins-core-0.1.16-1.fc22 dnf-1.1.6-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2016-573eba7b37
Comment 11 Fedora Update System 2016-01-26 14:52:54 EST
dnf-1.1.6-1.fc23, dnf-plugins-core-0.1.16-1.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-80cbf309b4
Comment 12 Fedora Update System 2016-01-28 13:20:14 EST
dnf-1.1.6-1.fc23, dnf-plugins-core-0.1.16-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
Comment 13 Fedora Update System 2016-01-28 18:19:31 EST
dnf-1.1.6-1.fc22, dnf-plugins-core-0.1.16-1.fc22 has been pushed to the Fedora 22 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-573eba7b37
Comment 14 Fedora Update System 2016-02-03 08:06:59 EST
dnf-1.1.6-2.fc22 dnf-plugins-core-0.1.16-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2016-573eba7b37
Comment 15 Fedora Update System 2016-02-03 18:27:03 EST
dnf-1.1.6-2.fc22, dnf-plugins-core-0.1.16-1.fc22 has been pushed to the Fedora 22 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-573eba7b37
Comment 16 Fedora Update System 2016-02-16 23:22:23 EST
dnf-1.1.6-2.fc22, dnf-plugins-core-0.1.16-1.fc22 has been pushed to the Fedora 22 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.