Bug 733391 - Yum can cache updateinfo (and groups/pkgtags) for too long, in some cases
Summary: Yum can cache updateinfo (and groups/pkgtags) for too long, in some cases
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: yum
Version: 6.2
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: James Antill
QA Contact: Karel Srot
URL:
Whiteboard:
Depends On:
Blocks: 743047
TreeView+ depends on / blocked
 
Reported: 2011-08-25 15:47 UTC by James Antill
Modified: 2014-01-21 06:24 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
In very rare cases, the yum utility may have incorrectly kept using old updateinfo, pkgtags, and groups metadata. When this happened, users may have been unaware of available updates for up to 6 hours. This update applies a patch that prevents yum from using outdated metadata, resolving this issue.
Clone Of:
Environment:
Last Closed: 2011-12-06 17:35:03 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1702 normal SHIPPED_LIVE yum bug fix and enhancement update 2011-12-06 00:49:49 UTC

Description James Antill 2011-08-25 15:47:31 UTC
Description of problem:

 There is a slight window where we can keep old cached updateinfo (and groups/pkgtags ... although it's really hard to have any problems there), when repodata updates due to:


i. yum blah => get repomd (including updateinfo.xml.gz)
ii. server updates updateinfo.xml etc.
iii. yum updateinfo => convert updateinfo.xml.gz to updateinfo.xml
iv. yum blah => get new repomd
v. yum update --security => still using the old updateinfo.xml because
   #iii is "newer" than #ii.

...given that the timestamps on RHN seem to be identical between
updateinfo and primary, that means that there is a ~6 hour window
between RHN putting new repodata out and a client not seeing until the
next time the repodata is changed in RHN (or the client manually cleans
the data).

 Now that probably sounds worse than it is because:

a. AFAIK it's not easy to do #i (get updateinfo.xml.gz without
converting it to updateinfo.xml). Manually changing the mdpolicy is the
only way I know, in yum ... rhn_check has open bugs about recent
versions downloading all repodata, but I don't think that is live.

b. If you don't have the updateinfo.xml.gz ... then AIUI RHN doesn't
keep old copies of repodata around, so yum will try and fetch "the
latest" and be given a 404 ... and then won't even get to step #2. At
which point the user can "yum clean expire-cache" or whatever and will
get the actual latest versions.


...here is the upstream patch:



commit 222e44bbb3d96f0f6d4f61766c0f31f03c0496b9
Author: James Antill <james@and.org>
Date:   Wed Aug 24 17:03:58 2011 -0400

    Fix problems with using old generated data (groups/pkgtag/updateinfo).

diff --git a/yum/misc.py b/yum/misc.py
index 37c572b..04490a6 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -1114,10 +1114,12 @@ def decompress(filename, dest=None, fn_only=False, check
         if check_timestamps:
             fi = stat_f(filename)
             fo = stat_f(out)
-            if fi and fo and fo.st_mtime > fi.st_mtime:
+            if fi and fo and fo.st_mtime == fi.st_mtime:
                 return out
 
         _decompress_chunked(filename, out, ztype)
+        if check_timestamps and fi:
+            os.utime(out, (fi.st_mtime, fi.st_mtime))

Comment 5 James Antill 2011-08-29 16:48:19 UTC
 Also as a great "outside yum" test you can do:

gzip -dc /var/cache/yum/path/to/repo/updateinfo.xml.gz > /tmp/abcd
cmp /var/cache/yum/path/to/repo/gen/updateinfo.xml /tmp/abcd

...and after a "yum updateinfo" command that should always match (ie. files cmp as identical).

Comment 9 Zdeněk Pavlas 2011-09-16 13:39:48 UTC
Added the James's upstream patch.

Comment 12 Jaromir Hradilek 2011-10-26 15:28:36 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
In very rare cases, the yum utility may have incorrectly kept using old updateinfo, pkgtags, and groups metadata. When this happened, users may have been unaware of available updates for up to 6 hours. This update applies a patch that prevents yum from using outdated metadata, resolving this issue.

Comment 13 errata-xmlrpc 2011-12-06 17:35: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-2011-1702.html


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