public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] report: make sure control charcters are encoded in xUnit report
@ 2018-05-19 17:43 Theodore Ts'o
  0 siblings, 0 replies; only message in thread
From: Theodore Ts'o @ 2018-05-19 17:43 UTC (permalink / raw)
  To: fstests; +Cc: Theodore Ts'o

Control characters (such as backspace, used in progress reports by
mkfs.ext4, for example) can make Python's XML parsers choke, claiming
that it is an invalid XML document.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 common/report | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/common/report b/common/report
index ffa23719..a62d343e 100644
--- a/common/report
+++ b/common/report
@@ -27,11 +27,12 @@ REPORT_ENV_LIST="$REPORT_ENV_LIST OVL_WORK"
 
 encode_xml()
 {
-    sed -e 's/&/\&amp;/g' \
-	-e 's/>/\&gt;/g' \
-	-e 's/</\&lt;/g' \
-	-e "s/'/\&apos;/g" \
-	-e 's/"/\&quot;/g'
+	cat -v | \
+	    sed -e 's/&/\&amp;/g' \
+		-e 's/>/\&gt;/g' \
+		-e 's/</\&lt;/g' \
+		-e "s/'/\&apos;/g" \
+		-e 's/"/\&quot;/g'
 }
 
 #
-- 
2.16.1.72.g5be1f00a9a


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-19 17:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-19 17:43 [PATCH] report: make sure control charcters are encoded in xUnit report Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox