Stop CORE::GLOBAL::glob lookup from crashing on stub
authorFather Chrysostomos <sprout@cpan.org>
Mon, 4 Nov 2013 01:27:07 +0000 (17:27 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 4 Nov 2013 13:10:19 +0000 (05:10 -0800)
‘sub CORE::GLOBAL::glob;’ doesn’t create a full glob, but cheats for
efficiency.  Compilation of glob ops was not taking this into account.

op.c
t/op/override.t

diff --git a/op.c b/op.c
index ee917b4..ee51a99 100644 (file)
--- a/op.c
+++ b/op.c
@@ -9225,6 +9225,7 @@ Perl_ck_glob(pTHX_ OP *o)
        GV * const * const gvp =
            (GV **)hv_fetchs(PL_globalstash, "glob", FALSE);
        gv = gvp ? *gvp : NULL;
+       if (gv && !isGV(gv)) gv_init(gv, PL_globalstash, "glob", 4, 0);
     }
 
     if (gv && GvCVu(gv) && GvIMPORTED_CV(gv)) {
index 16aec74..4474176 100644 (file)
@@ -8,7 +8,7 @@ BEGIN {
     require 'Config_heavy.pl'; # since runperl will need them
 }
 
-plan tests => 30;
+plan tests => 31;
 
 #
 # This file tries to test builtin override using CORE::GLOBAL
@@ -156,3 +156,6 @@ 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';
+is runperl(prog => 'sub CORE::GLOBAL::glob; glob; print qq-ok\n-'),
+  "ok\n",
+  'no crash with CORE::GLOBAL::glob stub';