Bug 924785 - xmllint considers schema content model not determinist, although it is deterministic
Summary: xmllint considers schema content model not determinist, although it is determ...
Keywords:
Status: CLOSED DUPLICATE of bug 922450
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libxml2
Version: 5.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Daniel Veillard
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-22 13:51 UTC by Colin Guthrie
Modified: 2013-07-25 02:34 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-06-04 13:14:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNOME Bugzilla 670865 0 Normal RESOLVED xmllint considers schema content model not determinist, although it is deterministic 2020-03-30 19:28:14 UTC

Description Colin Guthrie 2013-03-22 13:51:27 UTC
Followup to recent libxml2 update:
http://rhn.redhat.com/errata/RHBA-2013-0591.html

and likely a result of the following bugfix:
https://bugzilla.redhat.com/show_bug.cgi?id=915350


Something in the update seems to trigger a new bug related to schema validation:

https://bugzilla.gnome.org/show_bug.cgi?id=670865

and it's fix:

https://git.gnome.org/browse/libxml2/commit/?id=c70d185a2a3d09b0762560d4f93205da5d43396c

Certainly after updating to this version, I saw errors very similar to the ones reported above. The problems went away when I downgraded again.

Please can someone look at issuing another update for this?

Comment 1 Colin Guthrie 2013-03-22 15:03:57 UTC
Just for clarity (this info is on the gnome bug)

Test case:

Create a schema with the following content:
  <?xml version="1.0" encoding="UTF-8"?>
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="rules">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="rule" minOccurs="0" maxOccurs="unbounded"/>
          <xs:sequence minOccurs="0" maxOccurs="1">
            <xs:element name="specialRule" minOccurs="1" maxOccurs="1"/>
            <xs:element name="rule" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:sequence>
      </xs:complexType>
    </xs:element>
  </xs:schema>


Validate it with: xmllint --schema foo.xsd


It will print out usage info, but ignore that, just look at the errors above the usage which will state:

$ xmllint --schema foo.xsd 
foo.xsd:4: element complexType: Schemas parser error : local complex type: The content model is not determinist.
WXS schema foo.xsd failed to compile



However further testing would suggest it's not actually a regression with the above commit *in this particular test case*, but does fail on others!!

I will attempt to get a valid test case to you that highlights the before/after problems better...

Comment 2 Colin Guthrie 2013-03-22 15:11:42 UTC
OK, the following schema appears to show a difference for me before and after the update:


<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://foobar.org/wibble"
           elementFormDefault="qualified">

  <xs:element name="foo">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="bar" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element name="wibble" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
      </xs:choice>
      <xs:attribute name="version" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>

</xs:schema>


Before:
$ xmllint --schema test.xsd  2>&1 | head -n 4
Usage : xmllint [options] XMLfiles ...
	Parse the XML files and output the result of the parsing
	--version : display the version of the XML library used
	--debug : dump a debug tree of the in-memory document

After:
$ xmllint --schema test.xsd  2>&1 | head -n 4
test.xsd:6: element complexType: Schemas parser error : local complex type: The content model is not determinist.
WXS schema test.xsd failed to compile
Usage : xmllint [options] XMLfiles ...
	Parse the XML files and output the result of the parsing

Comment 3 Travers Carter 2013-04-10 02:11:29 UTC
I suspect that this is the same as Bug #922450.

Comment 4 Daniel Veillard 2013-06-04 13:14:09 UTC
This is indeed the same bug, applying the 2 patches indicated in Bug #922450
fixes the problem:

thinkpad:~/XML -> ./xmllint --schema 924785.xsd --noout foo.xml
foo.xml validates
thinkpad:~/XML -> cat 924785.xsd
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://foobar.org/wibble"
           elementFormDefault="qualified">

  <xs:element name="foo">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="bar" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element name="wibble" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
      </xs:choice>
      <xs:attribute name="version" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>

</xs:schema>
thinkpad:~/XML -> cat foo.xml
<foo xmlns="http://foobar.org/wibble" version="1"/>
thinkpad:~/XML -> 


Daniel

*** This bug has been marked as a duplicate of bug 922450 ***

Comment 5 Joe Cai 2013-07-24 07:28:03 UTC
What is going on with this one? I tried to find more information of Bug #922450, but it told me I am not authorized to access it.

Comment 6 Daniel Veillard 2013-07-25 02:34:45 UTC
An update fixing it will be pushed soon.

Daniel


Note You need to log in before you can comment on or make changes to this bug.