commit 3b868b243692b74705c65ccd6de13b55799d9499 Author: Bryn M. Reeves Date: Thu May 23 15:32:07 2013 +0100 Always use '-f-' when calling tar The tar program evaluates TAPE to determine the default tape device. This means that when sos is run with this environment variable set it may write the report data to the tape device and fail to generate a correct archive. This may cause a loss of data from the tape device as well as a loss of diagnostic data. Signed-off-by: Bryn M. Reeves diff --git a/sos/policyredhat.py b/sos/policyredhat.py index a93e92b..d19b9c2 100755 --- a/sos/policyredhat.py +++ b/sos/policyredhat.py @@ -268,7 +268,7 @@ class SosPolicy: if os.path.isfile("/usr/bin/xz"): self.report_file_ext = "tar.xz" self.renameResults("sosreport-%s-%s.%s" % (self.reportName, time.strftime("%Y%m%d%H%M%S"), self.report_file_ext)) - cmd = "/bin/tar -c %s | /usr/bin/xz -1 > %s" % (os.path.basename(self.cInfo['dstroot']),self.report_file) + cmd = "/bin/tar -cf- %s | /usr/bin/xz -1 > %s" % (os.path.basename(self.cInfo['dstroot']),self.report_file) p = Popen(cmd, shell=True, bufsize=-1) sts = os.waitpid(p.pid, 0)[1] else: