public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/9754] New: fflush after ungetc not POSIX compliant
@ 2009-01-17 13:39 bruno at clisp dot org
2009-01-17 13:39 ` [Bug libc/9754] " bruno at clisp dot org
0 siblings, 1 reply; 2+ messages in thread
From: bruno at clisp dot org @ 2009-01-17 13:39 UTC (permalink / raw)
To: glibc-bugs
In an decision on 2009-01-08, see
<http://www.opengroup.org/austin/aardvark/latest/xshbug3.txt>,
the Austin group decided about the behaviour of fflush after ungetc.
The following wording was adopted:
"For a stream open for reading, if the file is not already at
EOF, and the file is one capable of seeking, the file offset
of the underlying open file description shall be set to the
file position of the stream, and any characters pushed back
onto the stream by ungetc() or ungetwc() that have not
subsequently been read from the stream shall be discarded."
In this situation, glibc correctly drops the pushed back characters
and correctly keeps the stream's position unchanged, but something
inside the stream becomes inconsistent: the next fgetc call returns
a wrong result.
To reproduce:
$ gcc -O -Wall bug.c -o bug
$ ./bug < bug.c; echo $?
file position before fflush: 1
file position after fflush: 1
character read: ' ' but expected '*'
5
Expected output:
file position before fflush: 1
file position after fflush: 1
0
--
Summary: fflush after ungetc not POSIX compliant
Product: glibc
Version: 2.8
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: bruno at clisp dot org
CC: glibc-bugs at sources dot redhat dot com
GCC build triplet: x86_64-suse-linux
GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux
http://sourceware.org/bugzilla/show_bug.cgi?id=9754
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug libc/9754] fflush after ungetc not POSIX compliant
2009-01-17 13:39 [Bug libc/9754] New: fflush after ungetc not POSIX compliant bruno at clisp dot org
@ 2009-01-17 13:39 ` bruno at clisp dot org
0 siblings, 0 replies; 2+ messages in thread
From: bruno at clisp dot org @ 2009-01-17 13:39 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From bruno at clisp dot org 2009-01-17 13:39 -------
Created an attachment (id=3668)
--> (http://sourceware.org/bugzilla/attachment.cgi?id=3668&action=view)
test case
--
http://sourceware.org/bugzilla/show_bug.cgi?id=9754
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-01-17 13:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-17 13:39 [Bug libc/9754] New: fflush after ungetc not POSIX compliant bruno at clisp dot org
2009-01-17 13:39 ` [Bug libc/9754] " bruno at clisp dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).