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
No warnings when reading from a file only opened for appending. #9366
Comments
From @pjfCreated by @pjfG'day p5p and readers of perlbugs, Under all versions of Perl I have on my laptop (5.8.4, 5.8.8, 5.10.0, and open(FOO, '>', 'foo.txt'); However writing a file for appending doesn't: open(FOO, '>>', 'foo.txt'); I thought this would be easy enough to fix: Inline Patchdiff --git a/pp_hot.c b/pp_hot.c
index 64b5fc5..bc0d5fe 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1586,7 +1586,8 @@ Perl_do_readline(pTHX)
}
else if (type == OP_GLOB)
SP--;
- else if (ckWARN(WARN_IO) && IoTYPE(io) == IoTYPE_WRONLY) {
+ else if (ckWARN(WARN_IO) && ( IoTYPE(io) == IoTYPE_WRONLY ||
+ IoTYPE(io) == IoTYPE_APPEND)) {
report_evil_fh(PL_last_in_gv, io, OP_phoney_OUTPUT_ONLY);
}
}
Am I missing an IoTYPE that signifies a file is open for appending Many thanks, Paul -- Perl Info
|
From @rgs2008/6/7 via RT Paul Fenwick <perlbug-followup@perl.org>:
I think we could add a new IoTYPE. |
The RT System itself - Status changed from 'new' to 'open' |
From zefram@fysh.orgAppending is not the only case where there is insufficient information $ perl -lwe 'open(FOO, "|true") or die $!; $a = <FOO>; print "OK"' We should probably be looking a layer down, asking perlio about the -zefram |
Migrated from rt.perl.org#55420 (status was 'open')
Searchable as RT55420$
The text was updated successfully, but these errors were encountered: