<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 7/7/14, 9:23 AM, Jan Lieskovsky
wrote:<br>
</div>
<blockquote
cite="mid:272426350.8765999.1404739390803.JavaMail.zimbra@redhat.com"
type="cite">
<div class="moz-text-plain" wrap="true" graphical-quote="true"
style="font-family: -moz-fixed; font-size: 12px;"
lang="x-unicode">
<pre wrap="">This patch enhances the change introduced in:
[1] <a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://git.fedorahosted.org/cgit/scap-security-guide.git/commit/?id=7031613">https://git.fedorahosted.org/cgit/scap-security-guide.git/commit/?id=7031613</a>
it to be yet more verbose. Instead of reporting just file name, the error happened in,
report also what kind of error happened & particular line number of that processed file,
causing / leading to this error.
Current verify-input-sanity.py output:
utils]$ ./verify-input-sanity.py
XML syntax error in file: src/input/checks/platform/rhel6-cpe-dictionary.xml
XML syntax error in file: src/input/auxiliary/stig_overlay.xml
Output once the change is applied:
utils]$ ./verify-input-sanity.py
XML syntax error in file src/input/checks/platform/rhel6-cpe-dictionary.xml:
XML declaration allowed only at the start of the document, line 1, column 49
XML syntax error in file src/input/auxiliary/stig_overlay.xml:
XML declaration allowed only at the start of the document, line 1, column 49
The patch changes the behaviour all across the content (i.e. for verify-input-sanity.py
foreach of RHEL/6, RHEL/7, Fedora, Openstack & RHEVM3 -- tested for all cases, works fine).
Please review.
Thank you && Regards, Jan.
--
Jan iankko Lieskovsky / Red Hat Security Technologies Team
</pre>
</div>
<br>
<fieldset class="mimeAttachmentHeader"><legend
class="mimeAttachmentHeaderName">0001-utils-verify-input-sanity.py-Enhance-7031613-change-.patch</legend></fieldset>
<br>
<div class="moz-text-plain" wrap="true" graphical-quote="true"
style="font-family: -moz-fixed; font-size: 12px;"
lang="x-western">
<pre wrap="">From 3de86a9c94c5b2fdf804183b54c2585802d65841 Mon Sep 17 00:00:00 2001
From: Jan Lieskovsky <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:jlieskov@redhat.com"><jlieskov@redhat.com></a>
Date: Mon, 7 Jul 2014 15:05:52 +0200
Subject: [PATCH] [*/utils/verify-input-sanity.py] Enhance 7031613 change --
together with reporting in which file the error happened, report also what
kind of error is it & particular line number of the corresponding file
causing it
Signed-off-by: Jan Lieskovsky <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:jlieskov@redhat.com"><jlieskov@redhat.com></a>
---
Fedora/utils/verify-input-sanity.py | 5 +++--
OpenStack/utils/verify-input-sanity.py | 5 +++--
RHEL/6/utils/verify-input-sanity.py | 5 +++--
RHEL/7/utils/verify-input-sanity.py | 5 +++--
RHEVM3/utils/verify-input-sanity.py | 5 +++--
5 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/Fedora/utils/verify-input-sanity.py b/Fedora/utils/verify-input-sanity.py
index 1e0ec2c..c685a9e 100755
--- a/Fedora/utils/verify-input-sanity.py
+++ b/Fedora/utils/verify-input-sanity.py
@@ -129,8 +129,9 @@ for xccdf_file in xccdf_xml_files:
# parse the XML at this point
try:
tree = ET.fromstring(xccdf_xml_contents)
- except ET.XMLSyntaxError:
- print " XML syntax error in file: %s" % xccdf_file.replace("./", "src/input/")
+ except ET.XMLSyntaxError as e:
+ print " XML syntax error in file %s:" % xccdf_file.replace("./", "src/input/")
+ print " ", e.msg, "\n"
# extract all of the rules that are defined within the XCCDF
xccdf_rules = tree.findall(".//Rule")
for xccdf_rule in xccdf_rules:
diff --git a/OpenStack/utils/verify-input-sanity.py b/OpenStack/utils/verify-input-sanity.py
index 1e0ec2c..c685a9e 100755
--- a/OpenStack/utils/verify-input-sanity.py
+++ b/OpenStack/utils/verify-input-sanity.py
@@ -129,8 +129,9 @@ for xccdf_file in xccdf_xml_files:
# parse the XML at this point
try:
tree = ET.fromstring(xccdf_xml_contents)
- except ET.XMLSyntaxError:
- print " XML syntax error in file: %s" % xccdf_file.replace("./", "src/input/")
+ except ET.XMLSyntaxError as e:
+ print " XML syntax error in file %s:" % xccdf_file.replace("./", "src/input/")
+ print " ", e.msg, "\n"
# extract all of the rules that are defined within the XCCDF
xccdf_rules = tree.findall(".//Rule")
for xccdf_rule in xccdf_rules:
diff --git a/RHEL/6/utils/verify-input-sanity.py b/RHEL/6/utils/verify-input-sanity.py
index 1e0ec2c..c685a9e 100755
--- a/RHEL/6/utils/verify-input-sanity.py
+++ b/RHEL/6/utils/verify-input-sanity.py
@@ -129,8 +129,9 @@ for xccdf_file in xccdf_xml_files:
# parse the XML at this point
try:
tree = ET.fromstring(xccdf_xml_contents)
- except ET.XMLSyntaxError:
- print " XML syntax error in file: %s" % xccdf_file.replace("./", "src/input/")
+ except ET.XMLSyntaxError as e:
+ print " XML syntax error in file %s:" % xccdf_file.replace("./", "src/input/")
+ print " ", e.msg, "\n"
# extract all of the rules that are defined within the XCCDF
xccdf_rules = tree.findall(".//Rule")
for xccdf_rule in xccdf_rules:
diff --git a/RHEL/7/utils/verify-input-sanity.py b/RHEL/7/utils/verify-input-sanity.py
index 1e0ec2c..c685a9e 100755
--- a/RHEL/7/utils/verify-input-sanity.py
+++ b/RHEL/7/utils/verify-input-sanity.py
@@ -129,8 +129,9 @@ for xccdf_file in xccdf_xml_files:
# parse the XML at this point
try:
tree = ET.fromstring(xccdf_xml_contents)
- except ET.XMLSyntaxError:
- print " XML syntax error in file: %s" % xccdf_file.replace("./", "src/input/")
+ except ET.XMLSyntaxError as e:
+ print " XML syntax error in file %s:" % xccdf_file.replace("./", "src/input/")
+ print " ", e.msg, "\n"
# extract all of the rules that are defined within the XCCDF
xccdf_rules = tree.findall(".//Rule")
for xccdf_rule in xccdf_rules:
diff --git a/RHEVM3/utils/verify-input-sanity.py b/RHEVM3/utils/verify-input-sanity.py
index 1e0ec2c..c685a9e 100755
--- a/RHEVM3/utils/verify-input-sanity.py
+++ b/RHEVM3/utils/verify-input-sanity.py
@@ -129,8 +129,9 @@ for xccdf_file in xccdf_xml_files:
# parse the XML at this point
try:
tree = ET.fromstring(xccdf_xml_contents)
- except ET.XMLSyntaxError:
- print " XML syntax error in file: %s" % xccdf_file.replace("./", "src/input/")
+ except ET.XMLSyntaxError as e:
+ print " XML syntax error in file %s:" % xccdf_file.replace("./", "src/input/")
+ print " ", e.msg, "\n"
# extract all of the rules that are defined within the XCCDF
xccdf_rules = tree.findall(".//Rule")
for xccdf_rule in xccdf_rules:
<div class="moz-txt-sig">--
1.8.3.1
</div></pre>
</div>
</blockquote>
<br>
ack<br>
</body>
</html>