[xml/sgml-pkgs] Bug#130557: libxml2: Reading from standard-input
doesn't stop at EOF
Mike Hommey
mh at glandium.org
Sun Aug 14 10:55:15 UTC 2005
reassign 130557 zlib1g
thanks
On Wed, Jan 23, 2002 at 03:32:00PM +0000, Thomas Leonard <tal00r at ecs.soton.ac.uk> wrote:
> Package: libxml2
> Version: 2.4.13-1
> Severity: normal
>
> When xmlParseFile hits end-of-file, it keeps trying to read. Only after read()
> has failed multiple times does it actually stop. This is a problem when reading
> from standard-input, since it may be necessary to press Ctrl-D six times or
> more to end the input!
>
> Sample program:
>
> #include <parser.h>
>
> int main(void)
> {
> xmlDoc *doc;
>
> doc = xmlParseFile("-");
>
> return 0;
> }
>
> Test it with:
>
> $ gcc -o tree tree.c `xml2-config --libs --cflags`
> $ ./tree
>
> Enter anything here (valid XML or not). Ctrl-D must be pressed several
> times before the program terminates.
Today, I finally decided myself to look into this long-standing well
known bug, and realized this bug is actually zlib related. You can
reproduce the exact same behaviour with the following code snippet :
#include <zlib.h>
int main(void) {
gzFile fd;
char buffer[256];
fd = gzdopen(dup(0), "rb");
while(gzread(fd, buffer, 256));
gzclose(fd);
return 0;
}
Test it with:
$ gcc -o test test.c -lz
$ ./test
I'm reassigning to zlib
Cheers,
Mike
More information about the debian-xml-sgml-pkgs
mailing list