aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2012-12-11 21:16:22 +0000
committerBryn M. Reeves <bmr@redhat.com>2012-12-11 21:16:22 +0000
commitb5ed2bc6d592d36343f8b7ea790ab932f6e2a81e (patch)
treecad59c5d2a9683e56d334d3d1a3096b1762df517
parent1a0c39917ebc7c1636b702a6a6a0719b72795864 (diff)
downloadsos-b5ed2bc6d592d36343f8b7ea790ab932f6e2a81e.tar.gz
Fix regression TarFileArchive regression
Commit 179d9bb introduced a regression in the TarFileArchive class: (Pdb) bt /usr/sbin/sosreport(23)<module>() -> main(sys.argv[1:]) /usr/lib/python2.7/site-packages/sos/sosreport.py(908)main() -> sos.execute() /usr/lib/python2.7/site-packages/sos/sosreport.py(901)execute() -> return self.final_work() /usr/lib/python2.7/site-packages/sos/sosreport.py(773)final_work() -> self._finish_logging() /usr/lib/python2.7/site-packages/sos/sosreport.py(376)_finish_logging() -> self.archive.add_file(self.sos_log_file.name, dest=os.path.join('sos_logs', 'sos.log')) /usr/lib/python2.7/site-packages/sos/utilities.py(280)add_file() -> self.tarfile.addfile(tar_info, fileobj) /usr/lib64/python2.7/tarfile.py(2015)addfile() -> buf = tarinfo.tobuf(self.format, self.encoding, self.errors) /usr/lib64/python2.7/tarfile.py(996)tobuf() -> return self.create_gnu_header(info) /usr/lib64/python2.7/tarfile.py(1027)create_gnu_header() -> return buf + self._create_header(info, GNU_FORMAT) /usr/lib64/python2.7/tarfile.py(1112)_create_header() -> itn(info.get("mtime", 0), 12, format), > /usr/lib64/python2.7/tarfile.py(212)itn() -> raise ValueError("overflow in number field") The tarinfo mtime field is a float but the pax headers take a string-encoded value. The tarinfo field was inadvertently converted to a formatted string. The problem is hard to track down because it's not always triggered; the bug depends on the value of the string-encoded mtime date.
-rw-r--r--sos/utilities.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sos/utilities.py b/sos/utilities.py
index 30d53487..94298c9e 100644
--- a/sos/utilities.py
+++ b/sos/utilities.py
@@ -229,7 +229,7 @@ class TarFileArchive(Archive):
return None
def set_tar_info_from_stat(self, tar_info, fstat):
- tar_info.mtime = "%.9f" % fstat.st_mtime
+ tar_info.mtime = fstat.st_mtime
tar_info.pax_headers['atime'] = "%.9f" % fstat.st_atime
tar_info.pax_headers['ctime'] = "%.9f" % fstat.st_ctime
tar_info.mode = fstat.st_mode