After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 582906 - xmlschemas.c error validating multiple imports of the same schema with no targetNamespace
xmlschemas.c error validating multiple imports of the same schema with no tar...
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
2.7.3
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2009-05-16 22:36 UTC by Jason Childs
Modified: 2009-08-07 18:34 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26


Attachments
Testcases mentioned in the bug report (1014 bytes, application/x-bzip)
2009-05-16 22:37 UTC, Jason Childs
  Details
Proposed patch (967 bytes, patch)
2009-05-16 22:40 UTC, Jason Childs
none Details | Review

Description Jason Childs 2009-05-16 22:36:22 UTC
Please describe the problem:
When validating a schema that includes the same file that has no targetNamespace defined an internal error is thrown.

http://mail.gnome.org/archives/xml/2009-March/msg00014.html

Steps to reproduce:
1. Get the test-cases.tar.bz2 from this issue.
2. Unpack the archive and change to the case-1 directory
3. Run 'xmllint --schema aggregator.xsd validate_me.xml


Actual results:
You get a internal error:
xmlSchemaParseIncludeOrRedefine: trying to use an already parsed schema for a different targetNamespace

Expected results:
The schema should validate successfully.

Does this happen every time?
Yes

Other information:
From the XML Schema Part 1: Structures
"The ·XML Schema· corresponding to <schema> contains not only the components corresponding to its definition and declaration [children], but also all the components of all the ·XML Schemas· corresponding to any <include>d schema documents. Such included schema documents must either (a) have the same targetNamespace as the <include>ing schema document, or (b) no targetNamespace at all, in which case the <include>d schema document is converted to the <include>ing schema document's targetNamespace."

libxml2 should not throw this error, it should just reassign the targetNamespace of the including document to the one being parsed.
Comment 1 Jason Childs 2009-05-16 22:37:14 UTC
Created attachment 134786 [details]
Testcases mentioned in the bug report

The test cases for this error
Comment 2 Jason Childs 2009-05-16 22:40:44 UTC
Created attachment 134787 [details] [review]
Proposed patch

Here is a proposed patch that is better than the one submitted to the mailing list. It checks to see if bucket->origTargetNamespace is NULL.  If it is not then it prints an error message and exits gracefully.  The case-2 in the test-cases.tar.bz2 was an attempt to trigger this code, but the error gets caught earlier in the document parsing if a targetNamespace is assigned that is different from the importing document.
Comment 3 Daniel Veillard 2009-08-07 18:34:14 UTC
Okay ... yes I was surprized by the original suggestion on the list to
just remove the check in all cases, that looks just fine to me, thanks
a lot. Applied and commited, I also included both test cases in the
regression suite,

  thanks again !

Daniel