This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug stdio/12724] fclose violates POSIX 2008 on seekable input streams


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]