This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3] 10063
- From: Krister Walfridsson <cato at df dot lth dot se>
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Sat, 20 Dec 2003 21:20:18 +0100 (MET)
- Subject: Re: [v3] 10063
- References: <20031210113532.17845483.bkoz@redhat.com>
On Wed, 10 Dec 2003, Benjamin Kosnik wrote:
> 2003-12-10 Benjamin Kosnik <bkoz@redhat.com>
>
> PR libstdc++/10063
> * config/io/basic_file_stdio.cc (__basic_file::sys_open): Sync.
> * testsuite/ext/stdio_filebuf/char/10063-1.cc: New.
> * testsuite/ext/stdio_filebuf/char/10063-2.cc: New.
The 10063-2.cc test fails on NetBSD.
This is because the stream you get from fopen() is buffered, so
the whole file is already read when we eventually reach the read()
in xsgetn().
I'm not really sure how this is supposed to work, and I'm a bit
scared of the the conversions between FILE* and file descriptors
in basic_file_stdio.cc, so I'd prefer if someone who understand
this code looks at this... But I guess we need to do a ftell/lseek
song-and-dance at strategic points in the code...
Alternatively, if buffered streams are not supposed to work, then you
can make the test succeed by the patch below...
/Krister
2003-12-20 Krister Walfridsson <cato@df.lth.se>
* testsuite/ext/stdio_filebuf/char/10063-2.cc: Make stream unbuffered.
--- 10063-2.cc.orig Sat Dec 20 21:07:43 2003
+++ 10063-2.cc Sat Dec 20 21:08:01 2003
@@ -32,6 +32,7 @@
fbuf.close();
FILE* file = fopen("tmp_10063-2", "r");
+ setvbuf(file, NULL, _IONBF, 0);
int c = getc(file);
VERIFY(c == '0');
c = getc(file);