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
[PATCH] perl -e "eof or die" dies #16786
Comments
From @haukexHi all, As the subject says: These die, when AFAICT they shouldn't: $ perl -e "eof or die" These all work: $ perl -e "eof() or die" </dev/null It appears to be the same behavior on Linux and Windows. I ran a bisect and the commit that changed this is I'm definitely not an expert, but it looks to me like "if (!gv) Patch attached. (I didn't see a place where "eof" is really tested in Thanks, Regards, |
From @haukex0001-First-eof-should-return-true.patchFrom 2d068d8c80002d42cedd3f6f17630a1d70e22086 Mon Sep 17 00:00:00 2001
From: Hauke D <haukex@zero-g.net>
Date: Wed, 12 Dec 2018 22:26:26 +0100
Subject: [PATCH] First "eof" should return true
When no file has previously been opened, "eof" should return true. This
behavior was broken by 32e653230c7ccc (see also [#60978]).
---
pp_sys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pp_sys.c b/pp_sys.c
index 5dc20b14f0..e28e8906f1 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2121,7 +2121,7 @@ PP(pp_eof)
}
if (!gv)
- RETPUSHNO;
+ RETPUSHYES;
if ((io = GvIO(gv)) && (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar))) {
return tied_method1(SV_CONST(EOF), SP, MUTABLE_SV(io), mg, newSVuv(which));
--
2.19.2
|
From @jkeenanOn Wed, 12 Dec 2018 21:29:46 GMT, haukex@zero-g.net wrote:
An ack for your consideration: ##### Since eof() is often used to answer the question, "Is there any more input needing processing?", I would suggest tests should be written under t/io/. Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Wed, 12 Dec 2018 13:29:46 -0800, haukex@zero-g.net wrote:
Yeah, eof testing is kind of messy. I've added a TODO test in b4e880f, applied your change as eb699a9 with the addition is disarming the TODO. Thanks, |
@tonycoz - Status changed from 'open' to 'pending release' |
From @haukexHi, Thank you very much! and Happy New Year to all :-) Regards, On 02.01.19 02:16, Tony Cook via RT wrote:
|
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release today of Perl 5.30.0, this and 160 other issues have been Perl 5.30.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#133721 (status was 'resolved')
Searchable as RT133721$
The text was updated successfully, but these errors were encountered: