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 725667 - XInclude failure when path to base document includes spaces
XInclude failure when path to base document includes spaces
Status: RESOLVED OBSOLETE
Product: libxml2
Classification: Platform
Component: xinclude
git master
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2014-03-04 17:02 UTC by Griffin Myers
Modified: 2021-07-05 13:23 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Griffin Myers 2014-03-04 17:02:48 UTC
XInclude processing fails when the path to the base document includes spaces.  The example below is from the 2.9.1 source with xinclude.c modified to define DEBUG_XINCLUDE.  I suspect the bug is in uri.c, but do not have the resources to dig deeper at this time.

For this example consider two trivial files:

--page.xml--
<?xml version="1.0"?>
<webpage>
<body>Hello world!</body>
   <xi:include href="footer.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</webpage>

--footer.xml--
<?xml version="1.0"?>
<footer>Contoso Corp, 2003</footer>


Place identical copies of the files in two paths, one which contains no spaces and one which contains a space.  For my example is use /dirA/ and /dir B/


$ ./xmllint --version
./xmllint: using libxml version 20901
   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug Zlib


$ ./xmllint --xinclude ../../../dirA/page.xml
New context
Add node
New ref ../../../dirA/footer.xml
parse: xml
URI: ../../../dirA/footer.xml
Loading doc ../../../dirA/footer.xml:0
loading ../../../dirA/footer.xml
Recursing in doc ../../../dirA/footer.xml
New context
Freeing context
Done recursing in doc ../../../dirA/footer.xml
freeing ../../../dirA/footer.xml
Freeing context
Freeing ref
<?xml version="1.0"?>
<webpage>
<body>Hello world!</body>
   <footer>Contoso Corp, 2003</footer>
</webpage>


$ ./xmllint --xinclude ../../../dir\ B/page.xml
New context
Add node
New ref file://footer.xml
parse: xml
URI: file://footer.xml
Loading doc file://footer.xml:0
loading file://footer.xml
warning: failed to load external entity "file://footer.xml"
error looking for fallback
../../../dir%20B/page.xml:4: element include: XInclude error : could not load file://footer.xml, and no fallback was found
Freeing context
Freeing ref
<?xml version="1.0"?>
<webpage>
<body>Hello world!</body>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="file://footer.xml"/>
</webpage>



Notice the difference in URI's for the two cases.  For the path without the space it is a relative filesystem path.  With the space it is a file:// reference.
Comment 1 GNOME Infrastructure Team 2021-07-05 13:23:38 UTC
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.