GNOME Bugzilla – Bug 321068
libxml2 rng validation incorrectly handles 'start' overrides in 'include'
Last modified: 2021-07-05 13:21:08 UTC
I received the following report by Martin Vidner <mvidner-at-suse de> as https://bugzilla.novell.com/show_bug.cgi?id=132722 and I'm able to reproduce it with libxml2-2.6.22. Here I repeat Martin's text literally: The attached set of Relax NG schemas fails to compile in xmllint. Another validator, jing, has no such problem. (I test on a null document for simplicity). mvidner@valkyrie:bad2$ xmllint --noout --relaxng suse-primary.rng /dev/null suse-primary.rng:3: element include: Relax-NG parser error : xmlRelaxNG: include primary.rng has a start but not the included grammar suse-primary.rng:5: element ref: Relax-NG parser error : Some <start> element miss the combine attribute primary.rng:6: element ref: Relax-NG parser error : Found forbidden pattern start//interleave Relax-NG schema suse-primary.rng failed to compile /dev/null:1: parser error : Document is empty ^ /dev/null:1: parser error : Start tag expected, '<' not found ^ mvidner@valkyrie:bad2$ jing suse-primary.rng /dev/null /dev/null:1: fatal: Document root element is missing. Here are 3 rnc files and 3 rng equivalents generated by "trang suse-primary.rnc suse-primary.rng". Note that in the inclusion chain (suse-primary .. primary .. rpm-ns) the start element is overriden each time. If the override is commented out in suse-primary, libxml2 accepts the schema. (The override is actually useless here but not in the original files that were simplified for this testcase) From the error messages I infer that libxml2 wrongly applies the "combine" method, instead of replacing the definitions entirely as required when doing an include. (See 9.4 Replacing definitions in the RNC Tutorial, http://relaxng.org/compact-tutorial-20030326.html#id2815849)
Created attachment 54537 [details] test case (rng)
Still the same with 2.6.23 (this version string is missing in the "Version:" list).
Still the same with 2.6.27
Still the same with 2.6.30
Probably fixed by one of Nikolai Weibull's commits in 2.9.9: https://gitlab.gnome.org/GNOME/libxml2/commit/4338c310eb5e9402d0d4bf1cdf6d60430ac8a9a8 Now I get: $ xmllint --noout --relaxng suse-primary.rng /dev/null /dev/null:1: parser error : Document is empty ^
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxml2/-/issues/ Thank you for your understanding and your help.