This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug stdio/12724] fclose violates POSIX 2008 on seekable input streams
- From: "eblake at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 17 Jan 2014 22:10:30 +0000
- Subject: [Bug stdio/12724] fclose violates POSIX 2008 on seekable input streams
- Auto-submitted: auto-generated
- References: <bug-12724-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=12724
--- Comment #7 from Eric Blake <eblake at redhat dot com> ---
Intuitively, glibc is broken as long as:
$ seq 3 > file
$ { sed -n 1q; sed -n 1q; cat; } < file
has incorrect output. On Solaris, where fclose (and fflush(NULL) and exit())
correctly sync the seekable position of the FILE* back to the underyling fd,
the above test has the POSIX-mandated behavior of acting like 'tail -n+3 file'.
[It is possible to use gnulib's 'close-stdin' module to make 'sed' work around
glibc's bug, and in fact, coreutils already does so for all of its programs
which use stdin without reading to EOF; but we shouldn't have to work around
the bug in every single program that reads partial input from stdin when we can
instead fix it completely by fixing glibc]
--
You are receiving this mail because:
You are on the CC list for the bug.