xml2 icon indicating copy to clipboard operation
xml2 copied to clipboard

libxml2 2.9.13 changes recovery mode

Open kcphila opened this issue 3 years ago • 0 comments

This is more of a note on html processing, in case you are not aware.

libxml2 v2.9.13, which is the newest release that gets pulled in by apt on Ubuntu 22.04, changes how the "recovery" mode works for html rendering.

Since xml2 is used by many other packages (like kableExtra and modelsummary), this may end up being a repeated issue. See the following code:

xml2::read_html("* pval < 0.05; ** pval < 0.01")

For systems that have libxml2 v.2.9.12 or before installed, the output is as expected:

{html_document}
<html>
[1] <body><p>* pval &lt; 0.05; ** pval &lt; 0.01</p></body>

For systems that have libxml2 v.2.9.13 installed, it's truncated at the first less than sign:

{html_document}
<html>
[1] <body><p>* pval </p></body>

This is a result of the upstream devs reducing recovery mode processing to avoid DDoS attacks and generally simplify processing. They also indicate in the issue linked below that this functionality is likely to continue. There's an argument to say that xml2, like libxml2, should just be concerned with processes "correct" html/xml and users should not rely on consistent recovery mode or error handling, but this also seems like a change that will affect a lot of folks doing statistics.

https://gitlab.gnome.org/GNOME/libxml2/-/issues/339

kcphila avatar Aug 12 '22 16:08 kcphila