This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

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


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