GNOME Bugzilla – Bug 558551
Regex support for pattern facet in RNG validation yields incorrect results
Last modified: 2021-07-05 13:23:04 UTC
Please describe the problem: When attribute content is defined with a regular expression by means of the data/@pattern facet, libxml2 does not always evaluate the attribute content correctly. In particular, I am using regular expressions to ensure that an attribute contains a particular string either by itself or delimited from other strings by a space. Steps to reproduce: 1. Using the attached schema and test XML instances, at a bash prompt: $ for F in test0*.xml ; do xmllint --noout --relaxng regex.rng $F; done Actual results: test01.xml validates test02.xml:6: element caption: Relax-NG validity error : Did not expect element caption there test02.xml fails to validate test03a.xml:4: element code: Relax-NG validity error : Element code failed to validate attributes test03a.xml fails to validate test03b.xml:4: element code: Relax-NG validity error : Element code failed to validate attributes test03b.xml fails to validate test04a.xml:4: element code: Relax-NG validity error : Element code failed to validate attributes test04a.xml:6: element caption: Relax-NG validity error : Did not expect element caption there test04a.xml fails to validate test04b.xml:4: element code: Relax-NG validity error : Element code failed to validate attributes test04b.xml:6: element caption: Relax-NG validity error : Did not expect element caption there test04b.xml fails to validate test05.xml:4: element code: Relax-NG validity error : Element code failed to validate attributes test05.xml fails to validate Expected results: test01.xml validates test02.xml:6: element caption: Relax-NG validity error : Did not expect element caption there test02.xml fails to validate test03a.xml:4: element code: Relax-NG validity error : Element code failed to validate attributes test03a.xml fails to validate test03b.xml:4: element code: Relax-NG validity error : Element code failed to validate attributes test03b.xml fails to validate test04a.xml validates test04b.xml validates test05.xml validates Does this happen every time? Yes. Other information: test01.xml Should be valid (not of class 'listing' and no caption) test02.xml Should be invalid (not of class 'listing' but contains a caption) test03a.xml Should be invalid (class 'listing' but contains no caption) test03b.xml Variant on 3a: more than one token in @class test04a.xml Should be valid (class 'listing' and contains a caption) test04b.xml Variant on 4a: more than one token in @class test05.xml Should be valid (more than one token in @class, neither of them 'listing', and no caption)
Created attachment 121651 [details] Schema to exercise bug
Created attachment 121652 [details] Test instance (should be valid)
Created attachment 121653 [details] Test instance (should be invalid)
Created attachment 121654 [details] Test instance (should be invalid)
Created attachment 121655 [details] Test instance (should be invalid)
Created attachment 121656 [details] Test instance (should be valid)
Created attachment 121657 [details] Test instance (should be valid)
Created attachment 121658 [details] Test instance (should be valid)
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.