From: Hugo van der Sanden Date: Wed, 18 Oct 2000 23:25:58 +0000 (+0100) Subject: Re: [ID 20001018.008] flip-flop bug when there's no X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=790090df87a94d63cdbf866bce162581c29c2abf;p=p5sagit%2Fp5-mst-13.2.git Re: [ID 20001018.008] flip-flop bug when there's no Message-Id: <200010182225.XAA20330@crypt.compulink.co.uk> p4raw-id: //depot/perl@7365 --- diff --git a/pp_ctl.c b/pp_ctl.c index d69aaa8..cf2000e 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1005,10 +1005,17 @@ PP(pp_flip) else { dTOPss; SV *targ = PAD_SV(PL_op->op_targ); - - if ((PL_op->op_private & OPpFLIP_LINENUM) - ? (PL_last_in_gv && SvIV(sv) == (IV)IoLINES(GvIOp(PL_last_in_gv))) - : SvTRUE(sv) ) { + int flip; + + if (PL_op->op_private & OPpFLIP_LINENUM) { + struct io *gp_io; + flip = PL_last_in_gv + && (gp_io = GvIOp(PL_last_in_gv)) + && SvIV(sv) == (IV)IoLINES(gp_io); + } else { + flip = SvTRUE(sv); + } + if (flip) { sv_setiv(PAD_SV(cUNOP->op_first->op_targ), 1); if (PL_op->op_flags & OPf_SPECIAL) { sv_setiv(targ, 1); diff --git a/pp_hot.c b/pp_hot.c index 6f582c0..9b0573b 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1412,7 +1412,8 @@ Perl_do_readline(pTHX) } } if (!fp) { - if (ckWARN2(WARN_GLOB,WARN_CLOSED) && io && !(IoFLAGS(io) & IOf_START)) { + if (ckWARN2(WARN_GLOB, WARN_CLOSED) + && (!io || !(IoFLAGS(io) & IOf_START))) { if (type == OP_GLOB) Perl_warner(aTHX_ WARN_GLOB, "glob failed (can't start child: %s)", diff --git a/t/op/flip.t b/t/op/flip.t index 20167f3..f66af27 100755 --- a/t/op/flip.t +++ b/t/op/flip.t @@ -2,7 +2,7 @@ # $RCSfile: flip.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:52 $ -print "1..9\n"; +print "1..10\n"; @a = (1,2,3,4,5,6,7,8,9,10,11,12); @@ -27,3 +27,10 @@ if ($x eq 3) {print "ok 8\n";} else {print "not ok 8 $x:$foo:\n";} $x = 3.14; if (($x...$x) eq "1") {print "ok 9\n";} else {print "not ok 9\n";} + +{ + # coredump reported in bug 20001018.008 + readline(UNKNOWN); + $. = 1; + print "ok 10\n" unless 1 .. 10; +} diff --git a/t/pragma/warn/pp_hot b/t/pragma/warn/pp_hot index 3c3cc60..4268205 100644 --- a/t/pragma/warn/pp_hot +++ b/t/pragma/warn/pp_hot @@ -33,6 +33,9 @@ readline() on closed filehandle %s [Perl_do_readline] close STDIN ; $a = ; + readline() on closed filehandle %s [Perl_do_readline] + readline(NONESUCH); + glob failed (child exited with status %d%s) [Perl_do_readline] <