[PATCH] check the timestamp when validating the cache

Dennis Gregorovic <[email protected]>
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
Attached is a small patch which verifies that the checksum cache file is
more recent than the corresponding RPM.  This should handle the cases
where the RPM has changed but the old cache is still used (e.g. package
signing).

Cheers
-- Dennis

_______________________________________________
Rpm-metadata mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/rpm-metadata
cache-timestamp.patch (text/x-patch, 704 B)
Index: dumpMetadata.py
===================================================================
RCS file: /cvsroot/metadata/cvs-root/generate/dumpMetadata.py,v
retrieving revision 1.34
diff -u -r1.34 dumpMetadata.py
--- dumpMetadata.py 27 Nov 2005 23:01:01 -0000  1.34
+++ dumpMetadata.py 12 Jan 2006 19:42:02 -0000
@@ -568,0 +568,0 @@

         csumtag = '%s-%s' % (self.hdr['name'] , self.hdr[rpm.RPMTAG_SHA1HEADER])
         csumfile = '%s/%s' % (self.options['cachedir'], csumtag)
-        if os.path.exists(csumfile):
+        if os.path.exists(csumfile) and self.mtime <= os.stat(csumfile)[8]:
             csumo = open(csumfile, 'r')
             checksum = csumo.readline()
             csumo.close()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.