[yum-commits] 2 commits - yum/misc.py
zpavlas at osuosl.org
zpavlas at osuosl.org
Fri Jun 1 14:49:16 UTC 2012
yum/misc.py | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
New commits:
commit 1eff49352837c1da41c89b8dd48b19dc25d9ad77
Author: ZdenÄk Pavlas <zpavlas at redhat.com>
Date: Fri Jun 1 16:40:40 2012 +0200
safer misc.decompress()
Check timestamps when check_timestamps && fn_only.
This may fix weird bugs like BZ 825811 and BZ 826419.
(ctrl-c or no-space-left during decompression, then 'yum -C').
diff --git a/yum/misc.py b/yum/misc.py
index d11f60a..59aff5d 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -1129,16 +1129,19 @@ def decompress(filename, dest=None, fn_only=False, check_timestamps=False):
out = filename.replace('.xz', '')
else:
- out = filename # returning the same file since it is not compressed
- ztype = None
+ return filename # returning the same file since it is not compressed
- if ztype and not fn_only:
- if check_timestamps:
- fi = stat_f(filename)
- fo = stat_f(out)
- if fi and fo and fo.st_mtime == fi.st_mtime:
+ if check_timestamps:
+ fi = stat_f(filename)
+ fo = stat_f(out)
+ if fi and fo:
+ if fo.st_mtime == fi.st_mtime:
return out
+ if fn_only:
+ # out exists but not valid
+ return None
+ if not fn_only:
try:
_decompress_chunked(filename, out, ztype)
if check_timestamps and fi:
commit 2d13f65a7b59cf470674eb835f504252147c8f0b
Author: ZdenÄk Pavlas <zpavlas at redhat.com>
Date: Fri Jun 1 16:34:34 2012 +0200
Clean up partially decompressed files.
diff --git a/yum/misc.py b/yum/misc.py
index 55c433a..d11f60a 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -1139,9 +1139,13 @@ def decompress(filename, dest=None, fn_only=False, check_timestamps=False):
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))
+ try:
+ _decompress_chunked(filename, out, ztype)
+ if check_timestamps and fi:
+ os.utime(out, (fi.st_mtime, fi.st_mtime))
+ except:
+ unlink_f(out)
+ raise
return out
More information about the Yum-commits
mailing list