Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 750573 - sosreport cluster modules fail with badly formed cluster.conf
sosreport cluster modules fail with badly formed cluster.conf
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: sos (Show other bugs)
5.7
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Bryn M. Reeves
BaseOS QE - Apps
: EasyFix
Depends On:
Blocks: 773350 782064
  Show dependency treegraph
 
Reported: 2011-11-01 11:58 EDT by Bryn M. Reeves
Modified: 2012-08-10 05:01 EDT (History)
7 users (show)

See Also:
Fixed In Version: sos-1.7-9.58.el5
Doc Type: Bug Fix
Doc Text:
Cause: The sosreport command uses the python libxml2 bindings to parse XML formatted files such as /etc/cluster/cluster.conf. Malformed XML will trigger a parser exception. This exception was caught by the generic module handling routines and was not reported to the user. Consequence: Systems having a malformed cluster.conf will report no errors but the cluster module terminates abnormally without collecting a full set of data. Fix: The cluster module has been modified to catch parser exceptions internally and alter the user to the problem via a diagnostic message. Result: The sosreport command's cluster module now correctly identifies and reports these problems as well as collecting the complete set of information on such systems.
Story Points: ---
Clone Of:
: 773350 (view as bug list)
Environment:
Last Closed: 2012-02-20 22:25:53 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Avoid user visible exceptions when parsing XML (1.68 KB, patch)
2011-11-01 12:14 EDT, Bryn M. Reeves
no flags Details | Diff
Avoid user visible exceptions when parsing XML (2.64 KB, application/octet-stream)
2011-11-01 12:24 EDT, Bryn M. Reeves
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0153 normal SHIPPED_LIVE Low: sos security, bug fix, and enhancement update 2012-02-21 02:25:08 EST

  None (edit)
Description Bryn M. Reeves 2011-11-01 11:58:46 EDT
Description of problem:
Unhandled parserError exception from xmlParseFile generates an ugly backtrace if the cluster.conf contains malformed XML:

#sosreport --batch

sosreport (version 1.7)

This utility will collect some detailed  information about the
hardware and  setup of your  Red Hat Enterprise Linux  system.
The information is collected and an archive is  packaged under
/tmp, which you can send to a support representative.
Red Hat will use this information for diagnostic purposes ONLY
and it will be considered confidential information.

This process may take a while to complete.
No changes will be made to your system.


/etc/cluster/cluster.conf:27: parser error : AttValue: " or ' expected
                <fs device=/dev/el5-gfs2_vg0/ext3-1 force_fsck="1" force_unmount
                           ^
/etc/cluster/cluster.conf:27: parser error : attributes construct error
                <fs device=/dev/el5-gfs2_vg0/ext3-1 force_fsck="1" force_unmount
                           ^
/etc/cluster/cluster.conf:27: parser error : Couldn't find end of Start Tag fs line 27
                <fs device=/dev/el5-gfs2_vg0/ext3-1 force_fsck="1" force_unmount
                           ^
/etc/cluster/cluster.conf:29: parser error : Opening and ending tag mismatch: rm line 25 and cluster
</cluster>
          ^
/etc/cluster/cluster.conf:30: parser error : Premature end of data in tag cluster line 2

^
Traceback (most recent call last):
  File "/usr/sbin/sosreport", line 704, in ?
    sosreport()
  File "/usr/sbin/sosreport", line 525, in sosreport
    plug.diagnose()
  File "/usr/lib/python2.4/site-packages/sos/plugins/cluster.py", line 119, in diagnose
    xml = libxml2.parseFile("/etc/cluster/cluster.conf")
  File "/usr/lib64/python2.4/site-packages/libxml2.py", line 1240, in parseFile
    if ret is None:raise parserError('xmlParseFile() failed')
libxml2.parserError: xmlParseFile() failed


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


How reproducible:
100%

Steps to Reproduce:
1. Put some malformed XML in cluster.conf, e.g. unquoted attribute value.
2. run sosreport

  
Actual results:
uncaught parserError backtraces onto terminal

Expected results:
no exception, sos terminates normally

Additional info:
Found while testing fix for bug 655046
Comment 1 Bryn M. Reeves 2011-11-01 12:07:18 EDT
Same problem with unguarded parseFile calls in the gfs2 plugin.
Comment 2 Bryn M. Reeves 2011-11-01 12:14:58 EDT
Created attachment 531158 [details]
Avoid user visible exceptions when parsing XML

Wrap calls to libxml2.parseFile() with try/catch blocks.
Comment 3 Bryn M. Reeves 2011-11-01 12:24:22 EDT
Created attachment 531159 [details]
Avoid user visible exceptions when parsing XML

Also make sure we release libxml2 objects since they are not reference counted.
Comment 9 Bryn M. Reeves 2012-01-26 08:13:49 EST
    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:
Cause: The sosreport command uses the python libxml2 bindings to parse XML formatted files such as /etc/cluster/cluster.conf. Malformed XML will trigger a parser exception. This exception was caught by the generic module handling routines and was not reported to the user.

Consequence: Systems having a malformed cluster.conf will report no errors but the cluster module terminates abnormally without collecting a full set of data.

Fix: The cluster module has been modified to catch parser exceptions internally and alter the user to the problem via a diagnostic message.

Result: The sosreport command's cluster module now correctly identifies and reports these problems as well as collecting the complete set of information on such systems.
Comment 10 errata-xmlrpc 2012-02-20 22:25:53 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/RHSA-2012-0153.html

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