From: Father Chrysostomos Date: Mon, 4 Nov 2013 01:24:50 +0000 (-0800) Subject: Stop CORE::GLOBAL::do lookup from crashing on stub X-Git-Tag: upstream/5.20.0~1378 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=069abe75ae564d7bac9bdf9eeac40f3ca9447539;p=platform%2Fupstream%2Fperl.git Stop CORE::GLOBAL::do lookup from crashing on stub ‘sub CORE::GLOBAL::do;’ doesn’t create a full glob, but cheats for efficiency. Compilation of do-file ops was not taking this into account. --- diff --git a/op.c b/op.c index 40df34a154..ee917b4fdb 100644 --- a/op.c +++ b/op.c @@ -5478,6 +5478,7 @@ Perl_dofile(pTHX_ OP *term, I32 force_builtin) if (!(gv && GvCVu(gv) && GvIMPORTED_CV(gv))) { GV * const * const gvp = (GV**)hv_fetchs(PL_globalstash, "do", FALSE); gv = gvp ? *gvp : NULL; + if (gv && !isGV(gv)) gv_init(gv, PL_globalstash, "do", 2, 0); } } diff --git a/t/op/override.t b/t/op/override.t index 90510dd345..16aec74314 100644 --- a/t/op/override.t +++ b/t/op/override.t @@ -4,9 +4,11 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; + require Config; # load these before we mess with *CORE::GLOBAL::require + require 'Config_heavy.pl'; # since runperl will need them } -plan tests => 29; +plan tests => 30; # # This file tries to test builtin override using CORE::GLOBAL @@ -150,3 +152,7 @@ BEGIN { package other; *::caller = \&::caller } sub caller() { 42 } caller; # inline the constant is caller, 42, 'constant inlining does not undo "use subs" on keywords'; + +is runperl(prog => 'sub CORE::GLOBAL::do; do file; print qq-ok\n-'), + "ok\n", + 'no crash with CORE::GLOBAL::do stub';