Bug 1309065

Summary: dnf history info with range causes Python exception for transaction with no end timestamp
Product: [Fedora] Fedora Reporter: Daniel Miranda <danielkza2>
Component: dnfAssignee: Michael Mráka <mmraka>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: low    
Version: 23CC: jsilhan, kdudka, matt.hickford, mluscon, packaging-team-maint, pnemade, req1348, vmukhame
Target Milestone: ---Keywords: EasyFix, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-22 09:07:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Contents of yumdb that triggers the issue none

Description Daniel Miranda 2016-02-16 18:30:45 UTC
Created attachment 1127665 [details]
Contents of yumdb that triggers the issue

Description of problem:

A Python exception is thrown while trying to print history information for a range of  transactions, seemingly due to a transaction with no end timestamp.


Version-Release number of selected component (if applicable):

dnf.noarch-1.1.6-2.fc23


How reproducible:

Always with particular yum history


Steps to Reproduce:

1. Set DNF to use the attached db (maybe with --installroot)
2. Run `dnf history info 2088..3215` (respectively, the first and last transactions in the DB)


Actual results:

Information from the range of transactions is printed.


Expected results:

A Python exception is thrown.


Additional info:

Traceback (most recent call last):
  File "/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 1095, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/__init__.py", line 1218, in run
    ret = self.output.historyInfoCmd(extcmds)
  File "/usr/lib/python3.4/site-packages/dnf/cli/output.py", line 1518, in historyInfoCmd
    mobj.merge(tid)
  File "/usr/lib/python3.4/site-packages/dnf/yum/history.py", line 718, in merge
    if self.end_timestamp < obj.end_timestamp:
TypeError: unorderable types: int() < NoneType()

Comment 1 Igor Gnatenko 2016-02-16 18:54:55 UTC
hmm, how you got it without end_timestamp? ;)

Comment 2 Daniel Miranda 2016-02-16 20:22:54 UTC
No idea, my history seems to have mutated in some way, it seems full of strange things. It also seems to have weird state transitions that cause asserts to trigger. I also found some other small Py3 issues. I'll open a PR on GitHub with fixes for them.

Comment 3 M Hickford 2016-06-24 09:19:22 UTC
I have the same problem.

# dnf history info 109..136
Traceback (most recent call last):
  File "/usr/bin/dnf", line 58, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.5/site-packages/dnf/cli/main.py", line 174, in user_main
    errcode = main(args)
  File "/usr/lib/python3.5/site-packages/dnf/cli/main.py", line 60, in main
    return _main(base, args)
  File "/usr/lib/python3.5/site-packages/dnf/cli/main.py", line 112, in _main
    cli.run()
  File "/usr/lib/python3.5/site-packages/dnf/cli/cli.py", line 1096, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python3.5/site-packages/dnf/cli/commands/__init__.py", line 1220, in run
    ret = self.output.historyInfoCmd(extcmds)
  File "/usr/lib/python3.5/site-packages/dnf/cli/output.py", line 1518, in historyInfoCmd
    mobj.merge(tid)
  File "/usr/lib/python3.5/site-packages/dnf/yum/history.py", line 721, in merge
    if self.end_timestamp < obj.end_timestamp:
TypeError: unorderable types: int() < NoneType()

Comment 4 M Hickford 2016-06-24 09:30:26 UTC
Here's a simple patch that solved the problem on my computer https://github.com/rpm-software-management/dnf/pull/522

Comment 5 Kamil Dudka 2016-06-27 08:51:02 UTC
Still a bug in python3-dnf-1.1.9-2.fc23.noarch:

# dnf history rollback 187
Last metadata expiration check: 0:21:35 ago on Mon Jun 27 10:07:05 2016.
Traceback (most recent call last):
  File "/bin/dnf", line 58, 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 1096, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/__init__.py", line 1233, in run
    ret = self._hcmd_rollback(extcmds[1:])
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/__init__.py", line 1141, in _hcmd_rollback
    return self.base.history_rollback_transaction(extcmd)
  File "/usr/lib/python3.4/site-packages/dnf/cli/cli.py", line 638, in history_rollback_transaction
    mobj.merge(tid)
  File "/usr/lib/python3.4/site-packages/dnf/yum/history.py", line 721, in merge
    if self.end_timestamp < obj.end_timestamp:
TypeError: unorderable types: int() < NoneType()

Comment 6 Michael Mráka 2016-06-28 11:50:58 UTC
PR merged to master. Thanks.

Comment 7 Igor Gnatenko 2016-07-22 09:06:38 UTC
*** Bug 1287513 has been marked as a duplicate of this bug. ***

Comment 8 Igor Gnatenko 2016-07-22 09:07:23 UTC
Fixed as part of DNF 2.0 release which will be available soon.