Skip to content

Commit 4323c76

Browse files
edsantiagocevich
authored andcommitted
Strip out nonprintable characters from xml (#670)
Some test somewhere is generating an error message with ANSI codes: ^[[91mpermission denied. This is making Jenkins choke with invalid XML. Strip off chars not in ``string.printable`` in production of the XML data. The autotest and client logs preserve the erroneous output if inspecting it later is needed. This is just about getting the XML correct. Signed-off-by: Ed Santiago <[email protected]>
1 parent bc49a36 commit 4323c76

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

results2junit

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ file suitable by Jenkins.
1010
import argparse
1111
import os
1212
import re
13+
import string
1314
import sys
1415
import time
1516

@@ -39,7 +40,9 @@ def xml_escape(input_string):
3940
s_out = s_out.replace('<', '&lt;')
4041
s_out = s_out.replace('>', '&gt;')
4142
s_out = s_out.replace('"', '&quot;')
42-
return s_out
43+
44+
# Strip out nonprintable characters, e.g. escape sequences.
45+
return ''.join(c for c in s_out if c in string.printable)
4346

4447

4548
class TestSuite(object):

0 commit comments

Comments
 (0)