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 319279 - DOS-style line endings (CR-LF) sometimes read as double newline
DOS-style line endings (CR-LF) sometimes read as double newline
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:
 
 
Reported: 2005-10-20 02:55 UTC by Brion Vibber
Modified: 2006-01-09 14:39 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
Sample XML file with CR-LF newlines (811 bytes, text/xml)
2005-10-20 02:56 UTC, Brion Vibber
Details
Sample read & output using Python libxml2 module (132 bytes, text/plain)
2005-10-20 02:57 UTC, Brion Vibber
Details

Description Brion Vibber 2005-10-20 02:55:38 UTC
Distribution/Version: Ubuntu Breezy

When reading text node contents with the xmlTextReader interface, some lines 
with DOS-style line endings (\r\n) become double newlines (\n\n) in the read 
string.

1. Using xmlTextReader, read the attached sample XML file, which consists of 6-
digit numbers with \r\n end-of-lines.
2. Output the string value from the text node.

There will be an extra newline in output between lines 000063 and 000064. 
Extending the file, this will repeat every 64 lines (at 000127, etc).

Tested on Linux (Ubuntu Breezy) and Mac OS X, problem still present in CVS HEAD. 
Confirmed with raw C as well as Python and PHP 5.1.
Comment 1 Brion Vibber 2005-10-20 02:56:32 UTC
Created attachment 53673 [details]
Sample XML file with CR-LF newlines
Comment 2 Brion Vibber 2005-10-20 02:57:52 UTC
Created attachment 53674 [details]
Sample read & output using Python libxml2 module

Output from this Python program reading the sample file will include the extra
newlines. Equivalent program in C or PHP 5.1 does the same.
Comment 3 William M. Brack 2005-10-20 09:05:09 UTC
Fixed in cvs (parser.c) - thanks for the report.

Bill
Comment 4 Daniel Veillard 2006-01-09 13:32:45 UTC
need to be revisited, the fix is at the wrong level and broke entity processing
apparently c.f. bug
  http://bugzilla.gnome.org/show_bug.cgi?id=326295

Daniel
Comment 5 Daniel Veillard 2006-01-09 14:39:49 UTC
Okay fixed in a different way in xmlParseChunk() now.

Daniel