aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2018-05-19 13:43:10 -0400
committerEryu Guan <guaneryu@gmail.com>2018-05-21 16:12:39 +0800
commitb13f51d57153b697b6a29654e5aeb176945f16bb (patch)
treefc7cbae9f575bc738c53035420c3e71b4faccd1b
parent968ccf32e411591baa62a065f4f5460cb5be9c24 (diff)
downloadxfstests-dev-b13f51d57153b697b6a29654e5aeb176945f16bb.tar.gz
report: make sure control charcters are encoded in xUnit report
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>
-rw-r--r--common/report11
1 files changed, 6 insertions, 5 deletions
diff --git a/common/report b/common/report
index ffa23719de..a62d343e52 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'
}
#