Open autarch opened 7 years ago
From drolsky@cpan.org (@autarch) on 2010-06-26 19:55:57:
Sorry for the slow reply.
This is really a bug in the Perl core, and should probably be reported there.
As for a hackaround in Devel::StackTrace, any such thing would need to not use $& to be useful.
From ghewson@wormhole.me.uk on 2010-10-03 17:22:30:
On Sat Jun 26 15:55:57 2010, DROLSKY wrote:
This is really a bug in the Perl core, and should probably be reported there.
I've just submitted a report to perlbug@perl.org. I've written a stripped-down amalgamation of Alexandre's test case and Devel::StackTrace, which I attach here.
Graeme Hewson
From ghewson@wormhole.me.uk on 2010-10-03 18:03:02:
My report is now at http://rt.perl.org/rt3/Public/Bug/Display.html?id=78186
From ghewson@wormhole.me.uk on 2010-10-04 17:52:07:
OK, so the core problem is not realistically fixable. It seems a workaround is the best we could do.
I don't know if this has any relevance, which I happened to notice in perl5134delta ("what is new for perl v5.13.4"):
"Carp" Upgraded from version 1.16 to 1.18.
Carp now detects incomplete caller() overrides and avoids using bogus @DB::args. To provide backtraces, Carp relies on particular behaviour of the caller built-in. Carp now detects if other code has overridden this with an incomplete implementation, and modifies its backtrace accordingly. Previously incomplete overrides would cause incorrect values in backtraces (best case), or obscure fatal errors (worst case) This fixes certain cases of "Bizarre copy of ARRAY" caused by modules overriding "caller()" incorrectly.
From bbyrd@cpan.org (@sineswiper) on 2012-04-23 00:56:54:
Getting hit by this, too, via Perl 5.14.2. So, it's not really fixed in CORE, and it might never be. Since this thing is used for Exception::Class, I think whatever workaround that can be implemented should be. We certainly don't want stuff to crash on us DURING the Exception, before we even get to print it.
From drolsky@cpan.org (@autarch) on 2012-04-23 01:36:22:
On Sun Apr 22 20:56:54 2012, BBYRD wrote:
Getting hit by this, too, via Perl 5.14.2. So, it's not really fixed in CORE, and it might never be. Since this thing is used for Exception::Class, I think whatever workaround that can be implemented should be. We certainly don't want stuff to crash on us DURING the Exception, before we even get to print it.
A good patch would be welcome. Bonus points for stealing the code from Carp that fixes some of these bugs (but not all, I'm sure).
I think the linked rt.perl ticket might provide a good test case.
Migrated from rt.cpan.org #50447 (status was 'open')
Requestors:
Attachments:
From alexandre.gorobets@gmail.com on 2009-10-13 14:12:36:
Simple (but awful) code, that raise error:
use Devel::StackTrace;
sub do_work { my $s = Devel::StackTrace->new( 'no_refs' => 1, ); }
sub call_with_args { my ($arghash, $func) = @; $func->( @{$arg_hash->{'args'}} ); }
my $h = {};
my $arg_hash = { 'args' => [ undef ] };
call_with_args( $arg_hash, sub { $arg_hash->{'args'} = []; do_work( sub { $h; } ); } );
I propose this solution (in StackTrace.pm)
sub _record_caller_data { my $self = shift;
}