#862322 [libxml2] Wrong warning/error about "colons are forbidden from PI names"

Package:
libxml2
Source:
libxml2
Description:
GNOME XML library
Submitter:
Andre Naujoks
Date:
2021-07-05 18:33:06 UTC
Severity:
normal
Tags:
#862322#5
Date:
2017-05-11 08:44:54 UTC
From:
To:
--- 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

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.

#862322#8
Date:
2017-05-11 09:40:13 UTC
From:
To:
Control: tag -1 upstream
We don't want to include patches that are not upstream, exactly because
there might very well be side effects otherwise not clear.
Here is where:
https://bugzilla.gnome.org/buglist.cgi?product=libxml2
https://bugzilla.gnome.org/enter_bug.cgi?product=libxml2

#862322#15
Date:
2017-05-11 13:55:33 UTC
From:
To:
Is it possible to link this bug to the upstream bug? I mean in a more
direct way than the textual link above.

Regards
  Andre

#862322#18
Date:
2017-05-12 07:19:00 UTC
From:
To:
Control: forwarded -1 https://bugzilla.gnome.org/show_bug.cgi?id=782520

Great, thank you!

Yap, does the above fit what you had in mind?  (now at the top of the
bug page there will be a "Forwarded" line)

#862322#25
Date:
2017-05-12 08:01:46 UTC
From:
To:
Yes that is exactly what I had in mind. Thank you!