Bug 966602 - potential data loss when TAPE is set
Summary: potential data loss when TAPE is set
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: sos
Version: 6.4
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Bryn M. Reeves
QA Contact: Filip Holec
Depends On:
TreeView+ depends on / blocked
Reported: 2013-05-23 14:24 UTC by Bryn M. Reeves
Modified: 2018-12-03 18:55 UTC (History)
7 users (show)

Fixed In Version: sos-2.2-39.el6
Doc Type: Bug Fix
Doc Text:
Cause: The sosreport command incorrectly assumes that the tar program will always default to writing data on standard output. This is not the case when the environment variable TAPE is set. Consequence: Data may be unexpectedly written to a tape device, or another location, expanded to by the TAPE environment variable. Fix: The sosreport command now always calls tar with the '-f-' option to force data to be written to standard output. Result: The location to which sos writes data is no longer influenced by the TAPE environment variable. Users who set this variable in their environment can run sosreport without risking overwriting data on existing tape devices.
Clone Of:
Last Closed: 2013-11-21 22:39:29 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1688 normal SHIPPED_LIVE sos bug fix and enhancement update 2013-11-21 00:39:30 UTC

Description Bryn M. Reeves 2013-05-23 14:24:01 UTC
Description of problem:
The tar invocation used by sos is effectively:


This is vulnerable to unexpected behaviour when the user has set the TAPE environment variable to some tape device in the system. Depending on the state of the device this could interfere with normal tape operations or corrupt data that is already present on the tape device.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
Without a tape device present:
1. # file /dev/st0
/dev/st0: cannot open `/dev/st0' (No such file or directory)
2. # TAPE="/dev/st0" sosreport --batch -o general
3. # file /dev/st0

Actual results:
# file /dev/st0
/dev/st0: POSIX tar archive (GNU)

No sosreport is generated in TMP.

Expected results:
# file /dev/st0
/dev/st0: cannot open `/dev/st0' (No such file or directory)

An sosreport is generated in TMP.

Additional info:
sos should always use '-f-' to explicitly write the archive to stdout.

Comment 1 Bryn M. Reeves 2013-05-23 14:50:40 UTC

Comment 6 errata-xmlrpc 2013-11-21 22:39:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.