Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 771393 - Sosreport fails for default values when rhn user name contains character '/' in it.
Sosreport fails for default values when rhn user name contains character '/' ...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: sos (Show other bugs)
6.2
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Bryn M. Reeves
David Kutálek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-03 10:44 EST by Yogesh
Modified: 2013-03-01 00:10 EST (History)
7 users (show)

See Also:
Fixed In Version: sos-2.2-18.el6
Doc Type: Bug Fix
Doc Text:
* Previous releases of sos used inconsistent input sanitization rules depending on whether user name and case information was supplied interactively or read from system configuration files * This caused sos to fail to properly sanitize certain invalid strings when read from configuration files and to apply different sanitization to the same strings when input interactively * All name and number sanitization is now carried out in a single location and all input routines have been modified to use these routines * Name and number sanitization rules are now applied consistently regardless of the source of the data
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-20 03:25:15 EDT
Type: ---
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 RHSA-2012:0958 normal SHIPPED_LIVE Low: sos security, bug fix, and enhancement update 2012-06-19 15:28:28 EDT

  None (edit)
Description Yogesh 2012-01-03 10:44:51 EST
Description of problem:
when rhn user name contains character '/' in it, Sosreport is giving following error
/bin/sh: /tmp/sosreport-ABCD/XYZ-20111230154705.tar.xz: No such file or directory
/bin/tar: -: Cannot write: Broken pipe
/bin/tar: Error is not recoverable: exiting now
Traceback (most recent call last):
  File "/usr/sbin/sosreport", line 23, in <module>
    sosreport(sys.argv[1:])
  File "/usr/lib/python2.6/site-packages/sos/sosreport.py", line 843, in sosreport
    GlobalVars.policy.displayResults()
  File "/usr/lib/python2.6/site-packages/sos/policyredhat.py", line 329, in displayResults
    fp = open(self.report_file, "r")
IOError: [Errno 2] No such file or directory: '/tmp/sosreport-ABCD/XYZ-20111230154705.tar.xz'


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


How reproducible:
Always

Steps to Reproduce:
1. Open /etc/sysconfig/rhn/systemid
2. Edit value of field 'username'. Add '/' character in username. e.g.
<name>username</name>
<value><string>abc/xyz</string></value>
3. Run command
# sosreport

  
Actual results:
Sosreport is giving following error
/bin/sh: /tmp/sosreport-ABCD/XYZ-20111230154705.tar.xz: No such file or directory
/bin/tar: -: Cannot write: Broken pipe
/bin/tar: Error is not recoverable: exiting now
Traceback (most recent call last):
  File "/usr/sbin/sosreport", line 23, in <module>
    sosreport(sys.argv[1:])
  File "/usr/lib/python2.6/site-packages/sos/sosreport.py", line 843, in sosreport
    GlobalVars.policy.displayResults()
  File "/usr/lib/python2.6/site-packages/sos/policyredhat.py", line 329, in displayResults
    fp = open(self.report_file, "r")
IOError: [Errno 2] No such file or directory: '/tmp/sosreport-ABCD/XYZ-20111230154705.tar.xz'

Expected results:
Sosreport should trim down character '/' from rhn username and continue..

Additional info:
Trivial patch to file - /usr/lib/python2.6/site-packages/sos/policyredhat.py
--- policyredhat.py.bkup	2012-01-03 21:18:23.223920912 +0530
+++ policyredhat.py	2012-01-03 21:06:52.627932715 +0530
@@ -246,6 +246,7 @@
         else:
             self.reportName = self.reportName
 
+	self.reportName = self.reportName.replace('/','')
         curwd = os.getcwd()
         os.chdir(os.path.dirname(self.cInfo['dstroot']))
         oldmask = os.umask(077)
Comment 21 Bryn M. Reeves 2012-05-01 09:18:05 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
* Previous releases of sos used inconsistent input sanitization rules depending on whether user name and case information was supplied interactively or read from system configuration files
* This caused sos to fail to properly sanitize certain invalid strings when read from configuration files and to apply different sanitization to the same strings when input interactively
* All name and number sanitization is now carried out in a single location and all input routines have been modified to use these routines
* Name and number sanitization rules are now applied consistently regardless of the source of the data
Comment 23 errata-xmlrpc 2012-06-20 03:25:15 EDT
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/RHSA-2012-0958.html

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