From 5b2ba0efa1b87aa514d665a7f64ada36617c720e Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Mon, 20 May 2024 15:50:33 +0200 Subject: refactor(tvix/eval): rewrite xml emitter to be simple-stupid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to be compatible with the nix XML generator, it’s easier to generate the XML directly, instead of going through a library which we have to bend to do what we need. Removes dependency on `xml-rs`, which came with a full XML parser that we didn’t use. Only takes a tiny bit of code for the XML escaping, somewhat simplified. I add a little escaping value, to make sure we have the same behaviour as nix proper. Interestingly enough, we never need to escape XML attribute names, because the `builtins.toXML` format encodes user-defined values as attribute keys only. So we only escape attribute values. Fixes: https://b.tvl.fyi/issues/399 Change-Id: If4d407d324864b3bb9aa3160e2ec6889f7727127 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11697 Tested-by: BuildkiteCI Reviewed-by: flokli Autosubmit: Profpatsch --- tvix/eval/src/tests/tvix_tests/eval-okay-toxml.nix | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-toxml.nix (limited to 'tvix/eval/src/tests/tvix_tests/eval-okay-toxml.nix') diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-toxml.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-toxml.nix new file mode 100644 index 000000000000..7d074048ddec --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-toxml.nix @@ -0,0 +1,2 @@ +# Check some corner cases regarding escaping. +builtins.toXML { a = "s"; "&-{" = ";&\""; } -- cgit 1.4.1