-
Notifications
You must be signed in to change notification settings - Fork 575
readline: clear the error flag if the error happens to be EAGAIN #22907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: blead
Are you sure you want to change the base?
Conversation
@tonycoz Thank you for this! Looks like there's a rebase needed to get this merged. |
(or the equivalent EWOULDBLOCK) This allows questionable code that tries to combine select and the readline flavour of buffered I/O to limp along. Such code is still risky due to select() checking the underlying OS handle and not the perl handle. Fixes Perl#22883
fc24855
to
6f0b2f1
Compare
This would mean that suddenly readline returning |
@book, @ap , @haarg I request the guidance of the PSC. In response to #20060, in #20103 I changed the error handling for readline(), this was applied for perl 5.38 and was documented in perl5380delta. Previously it would clear the error flag on the stream on pretty much any error, so if there was any sort of error reading from the stream the error flag for the stream would simply be cleared. This was changed to clear the error state in much more limited cases. This can include errors like trying to read from an output handle, reading from a handle opened to a directory and EWOULDBLOCK errors on sockets marked as non-blocking. This could also include hard errors like EIO Note that readline() was the only read op that cleared the error state like this, using read() or getc() instead does not clear the stream error state. This has caused some breakage downstream, including each of the soft error cases above (#22883 #20376 #21240) In this particular PR after some discussion in #22883 I suggested only ignoring the non-blocking file handle errors, and this PR implements that, though mixing buffered I/O and select() is generally a mistake. So what I'm looking for here is: should readline() revert to clearing the error state? (and inconsistency with read(), getc()) If not, should the change here be applied, clearing the error state only on EWOULDBLOCK/EAGAIN? |
(or the equivalent EWOULDBLOCK)
This allows questionable code that tries to combine select and the
readline flavour of buffered I/O to limp along. Such code is still
risky due to select() checking the underlying OS handle and not
the perl handle.
Fixes #22883