Bug 850433

Summary: One redundant new line char in gathered commands
Product: Red Hat Enterprise Linux 6 Reporter: David Kutálek <dkutalek>
Component: sosAssignee: Bryn M. Reeves <bmr>
Status: CLOSED ERRATA QA Contact: David Kutálek <dkutalek>
Severity: low Docs Contact:
Priority: low    
Version: 6.3CC: agk, bmr, gavin
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sos-2.2-32.el6 Doc Type: Bug Fix
Doc Text:
Cause: The python runtime's pipe communication interface adds an additional trailing newline ('\n') character to output read from an external program. Consequence: Files stored in the generated reports that are generated by running an external command include additional trailing whitespace that could interfere with attempts to compare file content. Fix: The sosreport command has been modified to remove this additional character when present. Result: File capture is now consistent between sos versions in Red Hat Enterprise Linux 5 and 6 simplifying comparison of diagnostic data captured on these two releases.
Story Points: ---
Clone Of:
: 971420 (view as bug list) Environment:
Last Closed: 2013-02-21 10:58:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 971420    

Description David Kutálek 2012-08-21 15:11:51 UTC
Description of problem:

sosreport appends a new line char (\n) after gathered command shell output. While this seems like an intention, behaviour now differs for RHEL6 and RHEL5, where line is not appended. It seems to me we can remove this additional new line char in RHEL6

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


How reproducible:

Always

Steps to Reproduce:
1. sosreport --batch -o general 
2. tar xf /tmp/sosreport-xxx.tar.xz
3. cat ./xxx/sos_commands/general/date 
4. date
  
Actual results:

Tue Aug 21 16:56:21 CEST 2012\n\n

Expected results:

Tue Aug 21 16:56:21 CEST 2012\n

Additional info:

Comment 1 Bryn M. Reeves 2012-10-17 14:18:04 UTC
This actually seems to be a python thing - we don't do anything to add the traling newline, it appears to just be a consequence of slurping the file up in pipe.communicate().

In RHEL5 we added a tweak to delete the last char if it is a '\n' (helpers.py::sosGetCommandOutput()). I'll do the same in 6 for consistency.

Comment 2 Bryn M. Reeves 2012-10-17 14:20:15 UTC
Before:
[root@rhel6-vm1 tmp]# cat rhel6-vm1-2012101715141350483291/sos_commands/general/date 
Wed Oct 17 15:14:56 BST 2012

[root@rhel6-vm1 tmp]#

After:
[root@rhel6-vm1 tmp]# cat rhel6-vm1-2012101715171350483426/sos_commands/general/date 
Wed Oct 17 15:17:07 BST 2012
[root@rhel6-vm1 tmp]#

Comment 7 errata-xmlrpc 2013-02-21 10:58:26 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.

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