Blame SOURCES/perl-5.16.1-perl-115206-Don-t-crash-when-vivifying.patch

9572a7
Ported to 5.16.1:
9572a7
9572a7
From 4505a31f43ca4e1a0e9203b389f6d4bebab9d899 Mon Sep 17 00:00:00 2001
9572a7
From: Father Chrysostomos <sprout@cpan.org>
9572a7
Date: Tue, 9 Oct 2012 20:47:18 -0700
9572a7
Subject: [PATCH] =?UTF-8?q?[perl=20#115206]=20Don=E2=80=99t=20crash=20when=20?=
9572a7
 =?UTF-8?q?vivifying=20$|?=
9572a7
MIME-Version: 1.0
9572a7
Content-Type: text/plain; charset=UTF-8
9572a7
Content-Transfer-Encoding: 8bit
9572a7
9572a7
It was trying to read the currently-selected handle without checking
9572a7
whether it was selected.  It is actually not necessary to initialise
9572a7
the variable this way, as the next use of get-magic on it will clobber
9572a7
the cached value.
9572a7
9572a7
This initialisation was originally added in commit d8ce0c9a45.  The
9572a7
bug it was fixing was probably caused by missing FETCH calls that are
9572a7
no longer missing.
9572a7
---
9572a7
 gv.c         |    5 +----
9572a7
 t/op/magic.t |    5 ++++-
9572a7
 2 files changed, 5 insertions(+), 5 deletions(-)
9572a7
9572a7
diff --git a/gv.c b/gv.c
9572a7
index f352452..cf02ca4 100644
9572a7
--- a/gv.c
9572a7
+++ b/gv.c
9572a7
@@ -1913,10 +1913,6 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
9572a7
 		Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
9572a7
 				 "$%c is no longer supported", *name);
9572a7
 	    break;
9572a7
-	case '|':		/* $| */
9572a7
-	    sv_setiv(GvSVn(gv), (IV)(IoFLAGS(GvIOp(PL_defoutgv)) & IOf_FLUSH) != 0);
9572a7
-	    goto magicalize;
9572a7
-
9572a7
 	case '\010':	/* $^H */
9572a7
 	    {
9572a7
 		HV *const hv = GvHVn(gv);
9572a7
@@ -1957,6 +1953,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
9572a7
 	case '>':		/* $> */
9572a7
 	case '\\':		/* $\ */
9572a7
 	case '/':		/* $/ */
9572a7
+	case '|':		/* $| */
9572a7
 	case '$':		/* $$ */
9572a7
 	case '\001':	/* $^A */
9572a7
 	case '\003':	/* $^C */
9572a7
diff --git a/t/op/magic.t b/t/op/magic.t
9572a7
index 3fb1ea1..1bcfbd9 100644
9572a7
--- a/t/op/magic.t
9572a7
+++ b/t/op/magic.t
9572a7
@@ -5,7 +5,7 @@ BEGIN {
9572a7
     chdir 't' if -d 't';
9572a7
     @INC = '../lib';
9572a7
     require './test.pl';
9572a7
-    plan (tests => 156);
9572a7
+    plan (tests => 157);
9572a7
 }
9572a7
 
9572a7
 # Test that defined() returns true for magic variables created on the fly,
9572a7
@@ -581,6 +581,11 @@ SKIP: {
9572a7
     }
9572a7
 }
9572a7
 
9572a7
+# $|
9572a7
+fresh_perl_is
9572a7
+ 'select f; undef *f; ${q/|/}; print STDOUT qq|ok\n|', "ok\n", {}, 
9572a7
+ '[perl #115206] no crash when vivifying $| while *{+select}{IO} is undef';
9572a7
+
9572a7
 # ^^^^^^^^^ New tests go here ^^^^^^^^^
9572a7
 
9572a7
 SKIP: {
9572a7
-- 
9572a7
1.7.7.6
9572a7