Bug 1259158

Summary: sosreport has regex bug
Product: Red Hat Certification Program Reporter: kchen-intel <ken.chen>
Component: redhat-certification-sosreportAssignee: Poornima <pkshiras>
Status: CLOSED WONTFIX QA Contact: Swati Goswami <swgoswam>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.0CC: dparikh, ken.chen, rreddy, sgupta
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-20 01:53:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 1260592    
Bug Blocks:    

Description kchen-intel 2015-09-02 06:33:16 UTC
Description of problem:
sos package have regex bugs in sos/plugins/openstack_*.py

Version-Release number of selected component (if applicable):
sos-3.2-16.el7ost.3.noarch

How reproducible:
mkdir -p /tmp/tmpest/tempest/sosreport_pre sosreport -p system,virt,openstack,network,kernel,services,storage,security --batch --tmp-dir /tmp/tmpest/tempest/sosreport_pre

Below errors will be got:

[plugin:openstack_swift] regex substitution failed for '/etc/swift/container.builder' with: ''utf8' codec can't decode byte 0x80 in position 0: invalid start byte'
[plugin:openstack_swift] regex substitution failed for '/etc/swift/container.ring.gz' with: ''utf8' codec can't decode byte 0x8b in position 1: invalid start byte'

The root cause is 
In /usr/lib/python2.7/site-packages/sos/plugins/openstack_swift.py
In below line:
self.do_path_regex_sub("/etc/swift/*.conf*", regexp, r"\1*********")
"/etc/swift/*.conf*" is invalid, and should be "/etc/swift/.*\.conf.*". The old regex will match file like /etc/swift/container.builder, which should not be matched.
And in /usr/lib/python2.7/site-packages/sos/plugins/openstack_*.py there are many "/etc/<project>/*", like in openstack_nova.py, self.do_path_regex_sub("/etc/nova/*", regexp, r"\1*********") In fact here it should be "/etc/nova/.*"

Comment 1 Poornima 2015-09-02 14:22:21 UTC
Hi Ken,

We need below details from your setup.

- Share us with the output tar file in attachment.

- could you provide us with contents of /etc/swift/*

- is there any binary data on your system?

Comment 2 Poornima 2015-09-03 10:13:58 UTC
checked: this is reproducible with sos-3.2-16.el7ost.3.noarch
assigning back for further actions.

Comment 3 Poornima 2015-09-14 05:28:23 UTC
Ken,

we have reported this issue in sos upstream.
code is merged: https://github.com/sosreport/sos/commit/887fc720db5eb980088f771187311e85e04598f9

Comment 4 Poornima 2015-11-20 06:15:32 UTC
Hi Ken,

Here is a quick update the reported behaviour 

sos regex issue is fixed with latest errata: 

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

https://access.redhat.com/errata/RHBA-2015:2496

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