From 779a0fdd68e4b21ddb5147b84c953928b51b1fee Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sun, 25 Aug 2013 07:07:37 -0700 Subject: Unbreak Concise glob output $ ./perl -MO=Concise -Ilib -le '; print <\n>' 8 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 23 -e:1) v:{ ->3 7 <@> print vK ->8 3 <0> pushmark s ->4 6 <@> glob[t2] lK/1 ->7 - <0> ex-pushmark s ->4 4 <$> const[PV "\n"] s ->5 Can't locate object method "NAME" via package "B::SPECIAL" at lib/B/Concise.pm line 707. CHECK failed--call queue aborted. e88567f2acf38fe5ed90a88569b808e82cd3eca1 is the first bad commit commit e88567f2acf38fe5ed90a88569b808e82cd3eca1 Author: Father Chrysostomos Date: Sun Nov 4 20:18:51 2012 -0800 Stop the glob operator from leaking GVs It was adding GVs to the symbol table (via newGVgen), so they would never be freed, even after the op was freed, unless done so explicitly. There is no reason for these GVs to be exposed. That means $gv->STASH returns a B::SPECIAL. B::Concise was not pre- pared to handle that. (cherry picked from commit 7b696247e72c0b92f1fcee2a830851021827aa4b) --- ext/B/B/Concise.pm | 9 ++++++++- ext/B/t/concise.t | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ext/B/B/Concise.pm b/ext/B/B/Concise.pm index 67876a1c8c..686bfafa23 100644 --- a/ext/B/B/Concise.pm +++ b/ext/B/B/Concise.pm @@ -711,7 +711,14 @@ sub concise_sv { $hr->{svaddr} = sprintf("%#x", $$sv); if ($hr->{svclass} eq "GV" && $sv->isGV_with_GP()) { my $gv = $sv; - my $stash = $gv->STASH->NAME; if ($stash eq "main") { + my $stash = $gv->STASH; + if (class($stash) eq "SPECIAL") { + $stash = ""; + } + else { + $stash = $stash->NAME; + } + if ($stash eq "main") { $stash = ""; } else { $stash = $stash . "::"; diff --git a/ext/B/t/concise.t b/ext/B/t/concise.t index ec911a0d8c..ac38bfda1f 100644 --- a/ext/B/t/concise.t +++ b/ext/B/t/concise.t @@ -10,7 +10,7 @@ BEGIN { require 'test.pl'; # we use runperl from 'test.pl', so can't use Test::More } -plan tests => 160; +plan tests => 161; require_ok("B::Concise"); @@ -455,4 +455,11 @@ $out = ); unlike $out, 'main::foo', '-nobanner'; +# glob +$out = + runperl( + switches => ["-MO=Concise"], prog=>'<.>', stderr => 1 + ); +like $out, '\*::', '<.>'; + __END__ -- cgit v1.2.1