]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
report: make sure control charcters are encoded in xUnit report
authorTheodore Ts'o <tytso@mit.edu>
Sat, 19 May 2018 17:43:10 +0000 (13:43 -0400)
committerEryu Guan <guaneryu@gmail.com>
Mon, 21 May 2018 08:12:39 +0000 (16:12 +0800)
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>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/report

index ffa23719de2f828912abbe3e8ed0c5798a518f02..a62d343e52167479a3e54cb0e1cda6ac923a2721 100644 (file)
@@ -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'
 }
 
 #