Bug 809375 - yum history order deformation by changed date
yum history order deformation by changed date
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: yum (Show other bugs)
7.0
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: James Antill
Hubert Kario
:
Depends On: 809373
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-03 04:29 EDT by Patrik Kis
Modified: 2014-06-13 09:03 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 809373
Environment:
Last Closed: 2014-06-13 09:03:41 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Patrik Kis 2012-04-03 04:29:50 EDT
+++ This bug was initially created as a clone of Bug #809373 +++

Description of problem:
When the system time is changed the yum history order follows the system time and not the order how the commands were performed.

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

How reproducible:
always

Steps to Reproduce:

1. Clean the history database and install a package
# yum history new
# date
Mon Apr  3 10:02:10 CEST 2056
# yum -y install zsh

2. Change the system time back and install another package
# date 040306`date +%M`
Mon Apr  3 06:02:00 CEST 2056
# yum -y install shed

3. Change the system time again back to the original and install another package
# date 040310`date +%M`
Mon Apr  3 10:02:00 CEST 2056
# yum -y install xs

4. Check the history
# yum history
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     1 | root <root>              | 2056-04-03 10:02 | Install        |    1   
     3 | root <root>              | 2056-04-03 10:02 | Install        |    1   
     2 | root <root>              | 2056-04-03 06:02 | Install        |    1   
Warning: RPMDB altered outside of yum.

5. Display the info about the "last" history entry
# yum history info
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
Transaction ID : 1
Begin time     : Mon Apr  3 10:02:30 2056
Begin rpmdb    : 655:dcb936703b97c9addadc75e7817d771f302efa27
End time       :            10:02:34 2056 (4 seconds)
End rpmdb      : 654:d5f844407840619c1cb3360e069420dc42156b9d **
User           : root <root>
Return-Code    : Success
Command Line   : -y install zsh
Transaction performed with:
    Installed     rpm-4.8.0-19.el6.x86_64                   @anaconda-RedHatEnterpriseLinux-201111171049.x86_64/6.2
    Installed     subscription-manager-0.96.17-1.el6.x86_64 @anaconda-RedHatEnterpriseLinux-201111171049.x86_64/6.2
    Installed     yum-3.2.29-22.el6.noarch                  @anaconda-RedHatEnterpriseLinux-201111171049.x86_64/6.2
    Installed     yum-metadata-parser-1.1.2-16.el6.x86_64   @anaconda-RedHatEnterpriseLinux-201111171049.x86_64/6.2
Packages Altered:
    Install zsh-4.3.10-4.1.el6.x86_64 @rhel62s

6. Try to redo/undo the last transaction
# yum history undo last
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
Undoing transaction 1, from Mon Apr  3 10:02:30 2056
    Install zsh-4.3.10-4.1.el6.x86_64 @rhel62s

7. 
# yum history rollback 3
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
Rollback to transaction 3, from Mon Apr  3 10:02:08 2056
  Undoing the following transactions: 1, 2, 3
    Install shed-1.15-5.el6.x86_64         @epel
    Install xs-0.1-2.git9c19777.el6.x86_64 @epel
    Install zsh-4.3.10-4.1.el6.x86_64      @rhel62s

# yum history rollback 2
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
Rollback to transaction 2, from Mon Apr  3 06:02:18 2056
  Undoing the following transactions: 1, 2, 3
    Install shed-1.15-5.el6.x86_64         @epel
    Install xs-0.1-2.git9c19777.el6.x86_64 @epel
    Install zsh-4.3.10-4.1.el6.x86_64      @rhel62s

# yum history rollback 1
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
Rollback to current, nothing to do


Actual results:
4. The history list is ordered by actual system time, while the "natural order" would be by ID, i.e. in which order each action took place.
5. The top entry from list is picked up, i.e. the one with newest system time, but not the one which was last performed. Event though it is not explicitly mentioned in man page or other document that this command will pick the last performed action, I'd say this is what people expect.
6. Again the last transaction by system time is picked, and not with highest ID. Man page says "Eg. if you’ve done 250 transactions, "last" refers to transaction 250 ..."
7. The rollback is screwed up too. Rollback to 2 and 3 seems to do the same and it is including itself too. Rollback to 1 is taken as the last transaction.

Expected results:
4. The history is ordered by transaction ID.
5. The history entry with highest transaction ID is shown.
6. The history entry with highest transaction ID is undone/redone..
7. As explained in man page: rollback to 1 rolls back 2 and 3, etc.

Additional info:
Comment 1 James Antill 2012-04-03 11:04:26 EDT
Fix upstream, one liner:

commit b070ced387a670b4fe1440f5e6ae086fe6e5ef3b
Author: James Antill <james@and.org>
Date:   Thu Oct 13 10:35:05 2011 -0400

    Ignore time skew by using sqlite IDs instead to order transactions. BZ
745635
Comment 4 James Antill 2012-11-12 14:42:20 EST
 I assume the fix should be in RHEL-7 by now.
Comment 6 Ludek Smid 2014-06-13 09:03:41 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

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