Bug 809392

Summary: yum history rollback ends with traceback
Product: Red Hat Enterprise Linux 6 Reporter: Patrik Kis <pkis>
Component: yumAssignee: James Antill <james.antill>
Status: CLOSED ERRATA QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: ksrot, zpavlas
Target Milestone: alpha   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 809394 (view as bug list) Environment:
Last Closed: 2012-06-20 13:54:03 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:
Bug Depends On:    
Bug Blocks: 809394    

Description Patrik Kis 2012-04-03 09:09:11 UTC
Description of problem:
When the same package is installed and removed more times and the yum history is replayed it end with traceback.

Version-Release number of selected component (if applicable):
yum-3.2.29-27.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. Clean the yum history
# yum history new

2. Install, remove and again install the same package
# yum -y install zsh
# yum -y remove zsh
# yum -y install zsh
# yum history
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     3 | root <root>              | 2012-04-03 05:05 | Install        |    1   
     2 | root <root>              | 2012-04-03 05:05 | Erase          |    1   
     1 | root <root>              | 2012-04-03 05:05 | Install        |    1   
history list

3. Perform a yum history rollback
# yum history rollback 2
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Rollback to transaction 2, from Tue Apr  3 05:05:19 2012
  Undoing the following transactions: 3
    Install zsh-4.3.10-5.el6.i686 @beaker-Server
...

# yum history rollback 1
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Rollback to transaction 1, from Tue Apr  3 05:05:08 2012
  Undoing the following transactions: 2, 3
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 285, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 136, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 438, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 1488, in doCommand
    ret = self._hcmd_rollback(base, extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 1408, in _hcmd_rollback
    base.historyInfoCmdPkgsAltered(mobj)
  File "/usr/share/yum-cli/output.py", line 1858, in historyInfoCmdPkgsAltered
    for hpkg in old.trans_data:
  File "/usr/lib/python2.6/site-packages/yum/history.py", line 307, in <lambda>
    trans_data = property(fget=lambda self: self._getTransData())
  File "/usr/lib/python2.6/site-packages/yum/history.py", line 509, in _getTransData
    _move_pkg_n(npkg, 'Reinstall')
  File "/usr/lib/python2.6/site-packages/yum/history.py", line 461, in _move_pkg_n
    self._move_pkg(sk, nstate, npkgtup2pkg, npkgstate2pkg)
  File "/usr/lib/python2.6/site-packages/yum/history.py", line 449, in _move_pkg
    xpkg = self._conv_pkg_state(xpkg, nstate)
  File "/usr/lib/python2.6/site-packages/yum/history.py", line 429, in _conv_pkg_state
    pkg._history)
  File "/usr/lib/python2.6/site-packages/yum/history.py", line 220, in __init__
    checksum, history)
  File "/usr/lib/python2.6/site-packages/yum/history.py", line 162, in __init__
    chk = checksum.split(':')
AttributeError: YumHistory instance has no attribute 'split'

  
Actual results:
yum history rollback 1
 * ends with traceback

Expected results:
yum history rollback 1
 * performs the transactions even if the system will end up on the same state (the package is uninstalled and installed again)

Additional info:

Comment 2 James Antill 2012-04-03 14:25:44 UTC
This is already fixed in rawhide/F16/F17/upstream:

commit 2216e1a8d352718e92ebb14ff57f9635d960c29c
Author: James Antill <james>
Date:   Thu Dec 1 13:09:29 2011 -0500

    Fix _conv_pkg_state when calling with history as checksum. BZ 757736.

...one line easy fix.

Comment 9 errata-xmlrpc 2012-06-20 13:54:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0857.html