[yum-commits] yum/misc.py
zpavlas at osuosl.org
zpavlas at osuosl.org
Thu Jun 14 11:49:50 UTC 2012
yum/misc.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
New commits:
commit acf62d4201ca9ce40e6d6550df0280ff3cf58b2c
Author: Scott Tsai <scottt.tw at gmail.com>
Date: Thu Jun 14 18:34:00 2012 +0800
misc.decompress(): compare mtime without sub second precision. BZ 831918
On Linux filesystems with nano second timestamps,
Python's os.stat() and os.utime() don't guarantee timpestamps
would compare equal when read back (http://bugs.python.org/issue14127).
This patch reduces timestamp precision to seconds before comparing them.
diff --git a/yum/misc.py b/yum/misc.py
index 59aff5d..968b5eb 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -1135,7 +1135,9 @@ def decompress(filename, dest=None, fn_only=False, check_timestamps=False):
fi = stat_f(filename)
fo = stat_f(out)
if fi and fo:
- if fo.st_mtime == fi.st_mtime:
+ # Eliminate sub second precision in mtime before comparision,
+ # see http://bugs.python.org/issue14127
+ if int(fo.st_mtime) == int(fi.st_mtime):
return out
if fn_only:
# out exists but not valid
More information about the Yum-commits
mailing list