From: Father Chrysostomos Date: Sun, 25 Aug 2013 14:07:37 +0000 (-0700) Subject: Unbreak Concise glob output X-Git-Tag: upstream/5.20.0~2137 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b696247e72c0b92f1fcee2a830851021827aa4b;p=platform%2Fupstream%2Fperl.git 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. --- diff --git a/ext/B/B/Concise.pm b/ext/B/B/Concise.pm index 2007226..b074906 100644 --- a/ext/B/B/Concise.pm +++ b/ext/B/B/Concise.pm @@ -704,7 +704,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 b945e56..948d836 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"); @@ -459,4 +459,11 @@ $out = ); unlike $out, 'main::foo', '-nobanner'; +# glob +$out = + runperl( + switches => ["-MO=Concise"], prog=>'<.>', stderr => 1 + ); +like $out, '\*::', '<.>'; + __END__