Skip to content

Commit

Permalink
Always use '-f-' when calling tar
Browse files Browse the repository at this point in the history
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 <bmr@redhat.com>
  • Loading branch information
bmr-cymru committed May 23, 2013
1 parent 04f3b2f commit 3b868b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sos/policyredhat.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def packageResults(self):
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:
Expand Down

0 comments on commit 3b868b2

Please sign in to comment.