[xml] v2.9.2 regression when using absolute paths without file: scheme in catalog?



Hi folks,

I am using MacPorts (https://www.macports.org/) and suspecting a
regression in libxml2 2.9.1 -> 2.9.2. Something with regard to handling
absolute file paths in XML catalogs and/or mapping them to the file: URI
scheme has changed.

In more detail:

When trying to parse a simple XHTML 1.0 strict file with PHP and resolving
externals, from the underlying libxml2 I get the error:

        failed to load external entity
"file:/opt/local/share/xml/html/4/xhtml1-strict.dtd³

Basically, that¹s the path given by my catalog file (maintained by another
MacPorts package)

<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog
V1.0//EN" 
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd";>

<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<public publicId="-//W3C//DTD XHTML 1.0 Strict//EN"
uri="/opt/local/share/xml/html/4/xhtml1-strict.dtd" />
<public publicId="-//W3C//DTD XHTML 1.0 Transitional//EN"
uri="/opt/local/share/xml/html/4/xhtml1-transitional.dtd" />
<public publicId="-//W3C//DTD XHTML 1.0 Frameset//EN"
uri="/opt/local/share/xml/html/4/xhtml1-frameset.dtd" />
<public publicId="-//W3C//ENTITIES Latin 1 for XHTML//EN"
uri="/opt/local/share/xml/html/4/xhtml-lat1.ent" />
<public publicId="-//W3C//ENTITIES Special for XHTML//EN"
uri="/opt/local/share/xml/html/4/xhtml-special.ent" />
<public publicId="-//W3C//ENTITIES Symbols for XHTML//EN"
uri="/opt/local/share/xml/html/4/xhtml-symbol.ent" />
<rewriteSystem systemIdStartString="http://www.w3.org/TR/xhtml1/DTD/";
rewritePrefix="/opt/local/share/xml/html/4/" />
<rewriteSystem 
systemIdStartString="http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/";
rewritePrefix="/opt/local/share/xml/html/4/" />
</catalog>


Note that the URIs are given as absolute paths without a scheme name.

Using dtruss, I figured out that libxml2 2.9.2 actually tries to
stat64("file:/opt/Š³) and fails.

The same occurs when running xmllint, however I don¹t get the error
message to surface there (maybe wrong switches?). But xmllint also shows
the difference:

With libxml2 2.9.1:

$ 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 Lzma
$ sudo dtruss -t stat64 xmllint --nonet --loaddtd --load-trace --noout
--noent test.xml 2>&1 | grep opt/local/share
Loaded URL="file:///opt/local/share/xml/html/4/xhtml-lat1.ent"
ID="-//W3C//ENTITIES Latin 1 for XHTML//EN"
Loaded URL="file:///opt/local/share/xml/html/4/xhtml-symbol.ent"
ID="-//W3C//ENTITIES Symbols for XHTML//EN"
Loaded URL="file:///opt/local/share/xml/html/4/xhtml-special.ent"
ID="-//W3C//ENTITIES Special for XHTML//EN"
stat64("/opt/local/share/xml/html/4/xhtml1-strict.dtd\0", 0x7FFF5CBD1948,
0x0)             = 0 0
stat64("/opt/local/share/xml/html/4/xhtml-lat1.ent\0", 0x7FFF5CBD18F8,
0x0)             = 0 0
stat64("/opt/local/share/xml/html/4/xhtml-symbol.ent\0", 0x7FFF5CBD18F8,
0x0)             = 0 0
stat64("/opt/local/share/xml/html/4/xhtml-special.ent\0", 0x7FFF5CBD18F8,
0x0)             = 0 0
(repeated lines omitted)


With libxml2 2.9.2:

$ xmllint --version
xmllint: using libxml version 20902
   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 Lzma
$ sudo dtruss -t stat64 xmllint --nonet --loaddtd --load-trace --noout
--noent test.xml 2>&1 | grep opt/local/share
Loaded URL="file:/opt/local/share/xml/html/4/xhtml-lat1.ent"
ID="-//W3C//ENTITIES Latin 1 for XHTML//EN"
Loaded URL="file:/opt/local/share/xml/html/4/xhtml-symbol.ent"
ID="-//W3C//ENTITIES Symbols for XHTML//EN"
Loaded URL="file:/opt/local/share/xml/html/4/xhtml-special.ent"
ID="-//W3C//ENTITIES Special for XHTML//EN"
stat64("file:/opt/local/share/xml/html/4/xhtml1-strict.dtd\0",
0x7FFF51174958, 0x2)             = -1 Err#2
stat64("/opt/local/share/xml/html/4/xhtml1-strict.dtd\0", 0x7FFF51174858,
0x0)             = 0 0
stat64("file:/opt/local/share/xml/html/4/xhtml-lat1.ent\0",
0x7FFF511748F8, 0x2)             = -1 Err#2
stat64("/opt/local/share/xml/html/4/xhtml-lat1.ent\0", 0x7FFF51174728,
0x0)             = 0 0
stat64("file:/opt/local/share/xml/html/4/xhtml-symbol.ent\0",
0x7FFF511748F8, 0x2)             = -1 Err#2
stat64("/opt/local/share/xml/html/4/xhtml-symbol.ent\0", 0x7FFF51174728,
0x0)             = 0 0
stat64("file:/opt/local/share/xml/html/4/xhtml-special.ent\0",
0x7FFF511748F8, 0x2)             = -1 Err#2
stat64("/opt/local/share/xml/html/4/xhtml-special.ent\0", 0x7FFF51174728,
0x0)             = 0 0


Question: Is that a regression in 2.9.2 that needs to be addressed? Or is
the way the relevant MacPorts package creates the catalog file (absolute
paths, omitting file: scheme) wrong and just "happened" to work in the
past?

Thanks
Matthias



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]