Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VUnit outputs illegal characters(0x0) in XML #356

Open
davidmedinasigasi opened this issue Jul 16, 2018 · 4 comments
Open

VUnit outputs illegal characters(0x0) in XML #356

davidmedinasigasi opened this issue Jul 16, 2018 · 4 comments

Comments

@davidmedinasigasi
Copy link
Contributor

Running python run.py -x test_report.xml in json4vhdl generates an XML that contains 0x0 in the <system-out> tag. However, most control characters under 0x20 are not allowed in XML.

@std-max
Copy link
Contributor

std-max commented May 31, 2022

I think the problem is due to the print of the content of the JSON object. This content contains a lot of NUL characters.

info("JSONContent: " & lf & JSONContent.Content);

In the example, we should use the trim function like this:

info("JSONContent: " & lf & JSON.json.jsonTrim(JSONContent.Content));

With that change, there is no invalid characters in the XML file.

However, that does not solve the problem in general. If a user prints invalid XML characters in VHDL, I think we should not prevent that action at the VHDL level but rather sanitize when the XML file is created with Python.

But ESCAPE character is invalid in XML, so what should we do when the log contains ANSI color escape sequences?
@umarcor @LarsAsplund

@std-max
Copy link
Contributor

std-max commented Jun 22, 2022

@eine maybe you have an idea to solve this?

@umarcor
Copy link
Member

umarcor commented Jun 23, 2022

@std-max, using the trim function in the json4vhdl example sounds as a good solution to me. Will you please propose a PR?

However, that does not solve the problem in general. If a user prints invalid XML characters in VHDL, I think we should not prevent that action at the VHDL level but rather sanitize when the XML file is created with Python.

But ESCAPE character is invalid in XML, so what should we do when the log contains ANSI color escape sequences?

I believe that a sane solution would be to split out the conflictive logs. So, I agree with you it should be done in Python, at the time the XML file is generated. However, rather than trying to transform or trim the content, we should just put it in a .log file and have a relative path in the XML field. That would imply generating a tarball instead of just a file. Nevertheless, it should be straightforward for any tool processing the XML to get the full log if desired.

/cc @Paebbels

@std-max
Copy link
Contributor

std-max commented Jun 23, 2022

@umarcor I will propose a PR this afternoon for the erroneous example.

I like the solution you proposed with a separate log file. Maybe I (or you if you have time) should file a new issue to propose the solution and see what @LarsAsplund and others think about it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants