Bug 1059184 - [abrt] yum: yumcommands.py:2984:_hcmd_stats:TypeError: 'bool' object has no attribute '__getitem__'
Summary: [abrt] yum: yumcommands.py:2984:_hcmd_stats:TypeError: 'bool' object has no a...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: yum
Version: 20
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:5f582054e74e63ba8f5836bdfac...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-29 11:41 UTC by Arsen B.
Modified: 2014-05-28 02:52 UTC (History)
4 users (show)

Fixed In Version: yum-3.4.3-137.fc19
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-02-28 18:29:43 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: backtrace (1.17 KB, text/plain)
2014-01-29 11:41 UTC, Arsen B.
no flags Details
File: environ (5.05 KB, text/plain)
2014-01-29 11:41 UTC, Arsen B.
no flags Details

Description Arsen B. 2014-01-29 11:41:48 UTC
Description of problem:
Error after trying to run 
$ yum history stats

Version-Release number of selected component:
yum-3.4.3-132.fc20

Additional info:
reporter:       libreport-2.1.11
cmdline:        /usr/bin/python /bin/yum history stats
executable:     /bin/yum
kernel:         3.12.8-300.fc20.x86_64
runlevel:       N 5
type:           Python
uid:            500

Truncated backtrace:
yumcommands.py:2984:_hcmd_stats:TypeError: 'bool' object has no attribute '__getitem__'

Traceback (most recent call last):
  File "/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 355, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 174, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 570, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 3071, in doCommand
    ret = self._hcmd_stats(base, extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 2984, in _hcmd_stats
    print _("  NEVRAC :"), locale.format("%6d", counts['nevrac'], True)
TypeError: 'bool' object has no attribute '__getitem__'

Local variables in innermost frame:
num: 34362368
trans_N: <yum.history.YumHistoryTransaction instance at 0x7f9eb079acb0>
self: <yumcommands.HistoryCommand instance at 0x7f9eb07acb90>
extcmds: ['stats']
base: <cli.YumBaseCli object at 0x7f9eb07a6ad0>
trans_1: <yum.history.YumHistoryTransaction instance at 0x7f9eb002ef38>
counts: False

Comment 1 Arsen B. 2014-01-29 11:41:52 UTC
Created attachment 857015 [details]
File: backtrace

Comment 2 Arsen B. 2014-01-29 11:41:54 UTC
Created attachment 857016 [details]
File: environ

Comment 3 Zdeněk Pavlas 2014-01-29 14:05:28 UTC
This should never happen, unless something has truncated, locked, or damaged the history file. (it has been already stat()'d correctly). Not sure how to reproduce, but a fix to print an error message instead is simple:

commit 3eb4cf70be01ecf4484feeb6ce6233b417889f8f
Author: Zdenek Pavlas <zpavlas>
Date:   Wed Jan 29 15:04:42 2014 +0100

    Fix a possible "yum history stats" tb. BZ 1059184

diff --git a/yumcommands.py b/yumcommands.py
index 8bba0c5..4214383 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -2976,6 +2976,9 @@ class HistoryCommand(YumCommand):
             print _("Transactions:"), 0
             return
         counts = base.history._pkg_stats()
+        if not counts:
+            msg = _("could not open history file: %s") % base.history._db_file
+            raise yum.Errors.MiscError, msg
         trans_1 = base.history.old("1")[0]
         print _("Transactions:"), trans_N.tid
         print _("Begin time  :"), time.ctime(trans_1.beg_timestamp)

Comment 4 Arsen B. 2014-01-29 14:27:25 UTC
@Zdeněk Pavlas thanks, there is no more error message after patching yumcommands.py

Comment 5 Zdeněk Pavlas 2014-01-29 14:46:48 UTC
Hmm, the patch should have only got rid of the traceback. Seems it really was some transient failure (locking issue, probably).  We'd need a reproducer to fix the root cause.

Comment 6 Fedora Update System 2014-02-13 11:50:59 UTC
yum-3.4.3-135.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/yum-3.4.3-135.fc20

Comment 7 Fedora Update System 2014-02-13 12:09:48 UTC
yum-3.4.3-135.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/yum-3.4.3-135.fc19

Comment 8 Fedora Update System 2014-02-14 08:01:53 UTC
Package yum-3.4.3-135.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing yum-3.4.3-135.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-2482/yum-3.4.3-135.fc20
then log in and leave karma (feedback).

Comment 9 Fedora Update System 2014-02-28 18:29:43 UTC
yum-3.4.3-137.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2014-05-28 02:52:51 UTC
yum-3.4.3-137.fc19 has been pushed to the Fedora 19 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.