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 731063 - xmlSaveUri() incorrectly recomposes URIs with rootless paths
xmlSaveUri() incorrectly recomposes URIs with rootless paths
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks: 760921
 
 
Reported: 2014-06-01 02:28 UTC by Dennis Filder
Modified: 2016-01-21 04:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix recomposing URIs with rootless paths in xmlSaveUri() (330 bytes, patch)
2014-06-01 02:28 UTC, Dennis Filder
none Details | Review

Description Dennis Filder 2014-06-01 02:28:16 UTC
Created attachment 277654 [details] [review]
Patch to fix recomposing URIs with rootless paths in xmlSaveUri()

xmlSaveUri() of libxml2 (snapshot 2014-05-31 and earlier) returns
bogus values when called with URIs that have rootless paths
(e.g. "urx:b:b" becomes "urx://b%3Ab" where "urx:b%3Ab" would be
correct).  This program demonstrates it:

/*   gcc -lxml2 -o xmlSaveUri xmlSaveUri.c   */
#include <stdio.h>
#include <libxml2/libxml/uri.h>

int main (void) {
  return printf("Returns `%s'.\n",
                xmlSaveUri(xmlParseURI("urx:b:b")));
}

This behaviour makes it impossible to process Open/LibreOffice files
with XInclude because of their namespace URIs
(e.g. "urn:oasis:names:tc:opendocument:xmlns:office:1.0").  It also
violates section 3 of RFC3986 which states that a URI can only have
"//" immediately after the scheme part IF it contains an authority
part which is not the case here.  Section 5.3 mentions it, too.

The attached patch should fix the error.
Comment 1 Daniel Veillard 2014-10-06 10:41:59 UTC
So that patch was actually pushed into git back in June, this raised a couple
of issues and led to subsequent patches, but this should be all solved now.

BTW the libxml2 code has a testURI.c utility already:
thinkpad:~/XML -> ./testURI urx:b:b
urx:b%3Ab
thinkpad:~/XML -> ./testURI urx:/
urx:/
thinkpad:~/XML -> ./testURI urx://
urx://
thinkpad:~/XML -> ./testURI urx:///
urx:///
thinkpad:~/XML -> ./testURI urx:///foo
urx:///foo
thinkpad:~/XML -> ./testURI urx://foo
urx://foo
thinkpad:~/XML -> ./testURI urx:/foo
urx:/foo
thinkpad:~/XML -> ./testURI urx:foo
urx:foo
thinkpad:~/XML -> 

   thanks !

Daniel
Comment 2 David Kilzer 2016-01-21 04:28:52 UTC
This fix may have caused:

Bug 760921: REGRESSION (8eb55d78): doc/examples/io1 test fails after fix for "xmlSaveUri() incorrectly recomposes URIs with rootless paths"
<https://bugzilla.gnome.org/show_bug.cgi?id=760921>