summaryrefslogtreecommitdiff
path: root/t/op/magic.t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-10-26 16:51:23 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-10-28 16:15:08 -0700
commitcf93a474d4757162f972857eb69a670bf2aad44d (patch)
treee759def8e12853b2bbe2dab4eef0b668ec0068b6 /t/op/magic.t
parent8465ba45245d0c78b43d10c2436bd926a67c99e9 (diff)
downloadperl-cf93a474d4757162f972857eb69a670bf2aad44d.tar.gz
Make PL_envgv refcounted
Otherwise deleting $::{ENV} will make chdir crash: $ perl -e 'delete $::{ENV}; chdir' Segmentation fault: 11 This happens because PL_envgv points to a freed SV and GvHV(PL_envgv) tries to access nonexistent fields.
Diffstat (limited to 't/op/magic.t')
-rw-r--r--t/op/magic.t6
1 files changed, 5 insertions, 1 deletions
diff --git a/t/op/magic.t b/t/op/magic.t
index 10bf62c80b..0c89c3802d 100644
--- a/t/op/magic.t
+++ b/t/op/magic.t
@@ -5,7 +5,7 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require './test.pl';
- plan (tests => 184);
+ plan (tests => 185);
}
# Test that defined() returns true for magic variables created on the fly,
@@ -201,6 +201,10 @@ END
is join(':',@val1), join(':',@val2);
cmp_ok @val1, '>', 1;
+# deleting $::{ENV}
+is runperl(prog => 'delete $::{ENV}; chdir; print qq-ok\n-'), "ok\n",
+ 'deleting $::{ENV}';
+
# regex vars
'foobarbaz' =~ /b(a)r/;
is $`, 'foo';