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
IO::Handle's error() method does not accurately reflect read errors #12782
Comments
From tchrist@perl.comThe documentation for IO::Handle reads: $io->error However, this is not true. For example, a failed read on a given handle IMPOSSIBLE CASE #1: errno set but has_error clear --tom #!/usr/bin/env perl use v5.6; # needed for handle autoviv use strict; use Carp; # first released in v5, already covered by use # IO::Handle first released in v5.3.7, but not autoloaded till v5.14!! main(); ########################################################################## sub main { test_tty(); ########################################################################## sub test_tty { sub test_nonblocking_read { my $path_fh = undef; sysopen($path_fh, $path_name, O_RDONLY | O_NONBLOCK) print "opened $path_name read-only, non-blocking\n"; print "handle blocking status = ", fmt_bool($path_fh->blocking), "\n"; print "Enter something, quickly: "; my $line = readline($path_fh); if ($errno || $has_error) { if ($errno && !$has_error) { print "errno was ", fmt_errno($errno), "\n"; } } if (close($path_fh)) { } sub fmt_bool { sub fmt_undef { BEGIN { my @_Errno2Sym; sub fmt_errno { } __END__ Testing TTY opened /dev/tty read-only, non-blocking closed /dev/tty That's all, folks! ============= Summary of my perl5 (revision 5 version 16 subversion 0) configuration: Characteristics of this binary (from libperl): |
From @jkeenanOn Sun Feb 17 14:53:43 2013, tom christiansen wrote:
Confirming that I got the same output on Darwin/PPC and Linux/i386. jimk |
The RT System itself - Status changed from 'new' to 'open' |
I believe this was fixed by 80c1f1e |
Here's what I got when I ran Tom's program with perl-5.38.0 today. (The server's Debian Linux has been upgraded a couple of times since 2013).
That's different from what Tom originally reported -- but I don't know whether it means the problem has been fixed or not. |
Migrated from rt.perl.org#116805 (status was 'open')
Searchable as RT116805$
The text was updated successfully, but these errors were encountered: