[xml/sgml-pkgs] Bug#862322: [libxml2] Wrong warning/error about "colons are forbidden from PI names"

Andre Naujoks nautsch2 at gmail.com
Thu May 11 08:44:54 UTC 2017


Package: libxml2
Version: 2.9.4+dfsg1-2.2
Severity: normal
Tags: patch

--- Please enter the report below this line. ---

Hi.

When parsing an XML Document, libxml2 wrongly reports an error
(seemingly without further consequences) about colons not being allowed
in Processing-Instruction names.

This is not true. The XML Specification
(https://www.w3.org/TR/REC-xml/#sec-pi and
https://www.w3.org/TR/REC-xml/#NT-Name) explicitly allows a colon (':')
as part of a PITarget, which is a Name in the XML specifications terms.
The last Version of the XML Specification, where a colon was not allowed
in a processing instruction name is over 20 years old and I think can be
safely ignored by now: https://www.w3.org/TR/WD-xml-lang-970331#NT-Name

Attached is a test document (test.xml), which triggers the warning, when
used for example with xmlstarlet like this:

$ xmlstarlet fo test.xml
test.xml:2.8: colons are forbidden from PI names 'pi:pi'
<?pi:pi pi?>
       ^
<?xml version="1.0"?>
<root>
  <?pi:pi pi?>
</root>

Also attached is a patch (libxml2_patch_colons_in_pinames.patch), that
removes the bit of code from libxml2, that triggers the message.

I am not sure about the side effects of the removed function-call, but
from the comments in the code it seems it should have aborted
processing. It specifically states for xmlNsErr: "Handle a fatal parser
error, i.e. violating Well-Formedness constraints". However it does not
really abort, which might warrant another bug report.

Regards
  Andre

--- System information. ---
Architecture: Kernel:       Linux 4.9.0-3-amd64

Debian Release: 9.0
  500 unstable-debug  debug.mirrors.debian.org   500 unstable
ftp2.de.debian.org   500 testing-debug   debug.mirrors.debian.org   500
testing         ftp2.de.debian.org     1 experimental-debug
ftp.de.debian.org     1 experimental    ftp.de.debian.org
--- Package information. ---
Package's Depends field is empty.

Package's Recommends field is empty.

Package's Suggests field is empty.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libxml2_patch_colons_in_pinames.patch
Type: text/x-patch
Size: 403 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debian-xml-sgml-pkgs/attachments/20170511/21081517/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.xml
Type: text/xml
Size: 28 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debian-xml-sgml-pkgs/attachments/20170511/21081517/attachment.xml>


More information about the debian-xml-sgml-pkgs mailing list