Bug 1287513 - [abrt] dnf: history.py:731:merge:TypeError: unorderable types: NoneType() < int()
[abrt] dnf: history.py:731:merge:TypeError: unorderable types: NoneType() < i...
Status: CLOSED DUPLICATE of bug 1309065
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
23
x86_64 Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: rpm-software-management
Fedora Extras Quality Assurance
https://retrace.fedoraproject.org/faf...
abrt_hash:10133f45bbdfeae4e2aea841d79...
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-12-02 04:19 EST by Dario Castellarin
Modified: 2016-07-22 05:06 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-07-22 05:06: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: _var_log_dnf.log (220.10 KB, text/plain)
2015-12-02 04:19 EST, Dario Castellarin
no flags Details
File: backtrace (1.37 KB, text/plain)
2015-12-02 04:19 EST, Dario Castellarin
no flags Details
File: dnf-makecache.log (488.37 KB, text/plain)
2015-12-02 04:19 EST, Dario Castellarin
no flags Details
File: environ (3.22 KB, text/plain)
2015-12-02 04:19 EST, Dario Castellarin
no flags Details

  None (edit)
Description Dario Castellarin 2015-12-02 04:19:13 EST
Description of problem:
After a botched update (laptop turned off in the middle of it) I'm trying a 'dnf history rollback' command, but I get a traceback and a SELinux warning.

Version-Release number of selected component:
dnf-1.1.4-2.fc23

Additional info:
reporter:       libreport-2.6.3
cmdline:        /usr/bin/python3 -OO /usr/bin/dnf --enablerepo=*-testing history rollback 51
executable:     /usr/bin/dnf
kernel:         4.2.6-301.fc23.x86_64
runlevel:       N 5
type:           Python3
uid:            0

Truncated backtrace:
history.py:731:merge:TypeError: unorderable types: NoneType() < int()

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/__init__.py", line 1231, in run
    ret = self._hcmd_rollback(extcmds[1:])
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/__init__.py", line 1139, 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 731, in merge
    if self.end_timestamp < obj.end_timestamp:
TypeError: unorderable types: NoneType() < int()

Local variables in innermost frame:
self: <dnf.yum.history.YumMergedHistoryTransaction object at 0x7f5147b60390>
obj: <dnf.yum.history.YumHistoryTransaction object at 0x7f5147b60438>
Comment 1 Dario Castellarin 2015-12-02 04:19:26 EST
Created attachment 1101367 [details]
File: _var_log_dnf.log
Comment 2 Dario Castellarin 2015-12-02 04:19:28 EST
Created attachment 1101368 [details]
File: backtrace
Comment 3 Dario Castellarin 2015-12-02 04:19:45 EST
Created attachment 1101369 [details]
File: dnf-makecache.log
Comment 4 Dario Castellarin 2015-12-02 04:19:46 EST
Created attachment 1101370 [details]
File: environ
Comment 5 Mike Goodwin 2016-04-22 22:39:32 EDT
I can confirm this up to F23 updates-testing 


>> 321 class YumHistoryTransaction(object):
   322     """ Holder for a history transaction. """
   323 
   324     def __init__(self, history, row):


The contents of row[] is as follows:


(Pdb) row
(238, 1461360892, '2556:6d9e7771bb3d3bb28446ed8104a1cb00df7c138a', None, None, 1000, None)


We can see that on L#330: 


330         self.end_timestamp    = row[3]


Assigns the NoneType to senf.end_timestamp, then on L#417 inside class YumMergedHistoryTransaction(YumHistoryTransaction): assumes obj.end_timestap's NoneType


 412         self.end_timestamp    = obj.end_timestamp


Which is compared on (now) L#718


   718         if self.end_timestamp < obj.end_timestamp:


This will likely also be an issue if there are any comparisons being done with:

   331         self.end_rpmdbversion = row[4]
 333         self.return_code      = row[6]
Comment 6 Mike Goodwin 2016-04-22 23:56:10 EDT
The error is in how "old" (L#1235) is handling partial transactions, now that I think about it, I did ctrl+c out of one of these transactions.... hence, I guess, the None types in the data set. 

>>1235     def old(self, tids=[], limit=None, complete_transactions_only=False):


Setting complete_transactions_only=False to True yields a different error:


ValueError: no transaction with given ID: 242


With the above set, it does list out most of the packages that need to be removed, and clearly fails on the transaction that I did not let complete.


The main thing that I noticed during this troubleshooting step, as I iterated through printing out the various row[]s is that other rows didn't have as many elements as the one that is presumably causing the error.

This perhaps points to the other end of the problem here being "what happens to the history sqlite db when a transaction is abruptly ended" - which is far far above my head. 

Cheers.
Comment 7 Kamil Dudka 2016-06-27 04:51:13 EDT
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 8 Mike Goodwin 2016-06-27 13:34:59 EDT
I doubt any of this will get resolved until DNF2, as this is the sentiment I've been seeing on their Github issues. FYI
Comment 9 Fedora Admin XMLRPC Client 2016-07-08 05:40:06 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 10 Igor Gnatenko 2016-07-22 05:06:38 EDT

*** This bug has been marked as a duplicate of bug 1309065 ***

Note You need to log in before you can comment on or make changes to this bug.