Bug 1287513 - [abrt] dnf: history.py:731:merge:TypeError: unorderable types: NoneType() < int()
Summary: [abrt] dnf: history.py:731:merge:TypeError: unorderable types: NoneType() < i...
Keywords:
Status: CLOSED DUPLICATE of bug 1309065
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 23
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:10133f45bbdfeae4e2aea841d79...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-12-02 09:19 UTC by Dario Castellarin
Modified: 2016-07-22 09:06 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-22 09:06:38 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: _var_log_dnf.log (220.10 KB, text/plain)
2015-12-02 09:19 UTC, Dario Castellarin
no flags Details
File: backtrace (1.37 KB, text/plain)
2015-12-02 09:19 UTC, Dario Castellarin
no flags Details
File: dnf-makecache.log (488.37 KB, text/plain)
2015-12-02 09:19 UTC, Dario Castellarin
no flags Details
File: environ (3.22 KB, text/plain)
2015-12-02 09:19 UTC, Dario Castellarin
no flags Details

Description Dario Castellarin 2015-12-02 09:19:13 UTC
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 09:19:26 UTC
Created attachment 1101367 [details]
File: _var_log_dnf.log

Comment 2 Dario Castellarin 2015-12-02 09:19:28 UTC
Created attachment 1101368 [details]
File: backtrace

Comment 3 Dario Castellarin 2015-12-02 09:19:45 UTC
Created attachment 1101369 [details]
File: dnf-makecache.log

Comment 4 Dario Castellarin 2015-12-02 09:19:46 UTC
Created attachment 1101370 [details]
File: environ

Comment 5 Mike Goodwin 2016-04-23 02:39:32 UTC
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-23 03:56:10 UTC
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 08:51:13 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 8 Mike Goodwin 2016-06-27 17:34:59 UTC
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 09:40:06 UTC
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 09:06:38 UTC

*** 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.