From: Father Chrysostomos Date: Mon, 4 Nov 2013 01:32:37 +0000 (-0800) Subject: Stop CORE::GLOBAL::require lookup from crashing on stub X-Git-Tag: upstream/5.20.0~1376 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fcea1f7ab3c76999bee1de7ecaccb9ac4b0584e2;p=platform%2Fupstream%2Fperl.git Stop CORE::GLOBAL::require lookup from crashing on stub ‘sub CORE::GLOBAL::require;’ doesn’t create a full glob, but cheats for efficiency. Compilation of require ops was not taking this into account. --- diff --git a/op.c b/op.c index ee51a99..b1f32a4 100644 --- a/op.c +++ b/op.c @@ -9744,6 +9744,8 @@ Perl_ck_require(pTHX_ OP *o) if (!(gv && GvCVu(gv) && GvIMPORTED_CV(gv))) { GV * const * const gvp = (GV**)hv_fetchs(PL_globalstash, "require", FALSE); gv = gvp ? *gvp : NULL; + if (gv && !isGV(gv)) + gv_init(gv, PL_globalstash, "require", 7, 0); } } diff --git a/t/op/override.t b/t/op/override.t index 4474176..71c2ac2 100644 --- a/t/op/override.t +++ b/t/op/override.t @@ -8,7 +8,7 @@ BEGIN { require 'Config_heavy.pl'; # since runperl will need them } -plan tests => 31; +plan tests => 32; # # This file tries to test builtin override using CORE::GLOBAL @@ -159,3 +159,6 @@ is runperl(prog => 'sub CORE::GLOBAL::do; do file; print qq-ok\n-'), is runperl(prog => 'sub CORE::GLOBAL::glob; glob; print qq-ok\n-'), "ok\n", 'no crash with CORE::GLOBAL::glob stub'; +is runperl(prog => 'sub CORE::GLOBAL::require; require re; print qq-o\n-'), + "o\n", + 'no crash with CORE::GLOBAL::require stub';