Bug 966602 - potential data loss when TAPE is set
potential data loss when TAPE is set
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: sos (Show other bugs)
6.4
All Linux
urgent Severity urgent
: rc
: ---
Assigned To: Bryn M. Reeves
Filip Holec
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-23 10:24 EDT by Bryn M. Reeves
Modified: 2017-02-07 07:45 EST (History)
7 users (show)

See Also:
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.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-21 17:39:29 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1688 normal SHIPPED_LIVE sos bug fix and enhancement update 2013-11-20 19:39:30 EST

  None (edit)
Description Bryn M. Reeves 2013-05-23 10:24:01 EDT
Description of problem:
The tar invocation used by sos is effectively:

  tar -c $PATH | $COMPRESS > $OUTPUT_FILE

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):
sos-2.2-*.el6

How reproducible:
100%

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 10:50:40 EDT
https://github.com/sosreport/sosreport/commit/3b868b2
Comment 6 errata-xmlrpc 2013-11-21 17:39:29 EST
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.

http://rhn.redhat.com/errata/RHBA-2013-1688.html

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