This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
RE: libstdc++/9533: Regression: Can't read from tty with ifstream
- From: Pétur Runólfsson <peturr02 at ru dot is>
- To: <paolo at gcc dot gnu dot org>,<gcc-bugs at gcc dot gnu dot org>,<nobody at gcc dot gnu dot org>,Pétur Runólfsson <peturr02 at ru dot is>,<gcc-gnats at gcc dot gnu dot org>
- Date: Sun, 2 Mar 2003 18:23:24 -0000
- Subject: RE: libstdc++/9533: Regression: Can't read from tty with ifstream
> Something is wrong, agreed, but I cannot reproduce the
> regression thing: for me (*), 3.2.2 asks the number but
> then hangs upon <newline>. Same behaviour 3.0.4.
Yes, that is the same behaviour I get (with 3.2.1). However,
mainline fails in a different manner (the program just exits).
I believe the culprit is this code in basic_file_stdio.cc
(__basic_file<char>::open), which is not present on the 3.2
branch:
#if defined (F_SETFL) && defined (O_NONBLOCK)
// Set input to nonblocking for fifos.
if (__mode & ios_base::in)
fcntl(this->fd(), F_SETFL, O_NONBLOCK);
#endif
This causes fread to return 0 immediately instead of waiting
for input, which in turn causes underflow to return eof().
Also, I think this counts as a regression, since the hang
(when compiled with 3.2.x) can be avoided by setting the
buffer size to 1.
Petur