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 734276 - wrong error column in structured error when skipping whitespace in xml declaration
wrong error column in structured error when skipping whitespace in xml declar...
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2014-08-05 11:51 UTC by jrgn.keil
Modified: 2014-08-07 08:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sample XML file, containing an error at line 1 column 53 (231 bytes, text/xml)
2014-08-05 11:51 UTC, jrgn.keil
  Details
Simple testcase; parses xml file and reports error via structured error handler (549 bytes, text/plain)
2014-08-05 12:00 UTC, jrgn.keil
  Details
Suggested fix - count horizontal whitespace characters (387 bytes, patch)
2014-08-05 12:05 UTC, jrgn.keil
none Details | Review

Description jrgn.keil 2014-08-05 11:51:21 UTC
Created attachment 282551 [details]
Sample XML file, containing an error at line 1 column 53

libxml2 reports wrong error column numbers (field int2 in xmlError)
in structured error handler, after an XML declaration containing whitespace.

Example XML:

<?xml  version="1.0"  encoding="UTF-8"     ?><root>&</root>
<!--
         1         2         3         4         5         6         7         8
12345678901234567890123456789012345678901234567890123456789012345678901234567890
-->

Expected location of the error would be line 1, column 53.

The actual location of the error is line 1, column 44:

$ ./xmlparse colbug1.xml 
colbug1.xml:1:44: xmlParseEntityRef: no name
Comment 1 jrgn.keil 2014-08-05 12:00:51 UTC
Created attachment 282552 [details]
Simple testcase; parses xml file and reports error via structured error handler

$ cc `xml2-config --cflags  --libs` -o xmlparse xmlparse.c
$ ./xmlparse colbug1.xml 
colbug1.xml:1:44: xmlParseEntityRef: no name

Expected output is:
colbug1.xml:1:53: xmlParseEntityRef: no name
Comment 2 jrgn.keil 2014-08-05 12:05:19 UTC
Created attachment 282553 [details] [review]
Suggested fix - count horizontal whitespace characters
Comment 3 Daniel Veillard 2014-08-07 08:30:26 UTC
Okay that looks fine too, pushed and commited in git as commit
5d4310af453a2220851b7063ebf165ce8b47494c

 thanks a lot !

Daniel