-
Notifications
You must be signed in to change notification settings - Fork 558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bizarre copy of ARRAY in sassign at Carp/Heavy.pm #9282
Comments
From chris@heathens.co.nzThis is a bug report for perl from chris@heathens.co.nz, The following test program gives this error: Bizarre copy of ARRAY in sassign at /usr/lib/perl5/5.8.8/Carp/Heavy.pm line 45. Tested on the 5.8.x branch and on perl-current. use Carp; sub do_carp { sub call_with_args { my $h = {}; Flags: This perlbug was built using Perl v5.8.8 in the Red Hat build system. Site configuration information for perl v5.8.8: Configured by Red Hat, Inc. at Thu Jan 31 13:32:29 EST 2008. Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Locally applied patches: @INC for perl v5.8.8: Environment for perl v5.8.8: |
From @nwc10On Tue, Apr 08, 2008 at 11:39:25AM -0700, Chris Heath wrote:
Thanks for this bug report. The error has been seen before, but not with this $ cat C.pm use Devel::Peek; Dump \@DB::args; foreach(@DB::args) { 1; sub do_carp { sub call_with_args { my $h = {}; [the line with Devel::Peek is optional] It looks like the address of something on Perl's stack ends up being re-used Nicholas Clark |
The RT System itself - Status changed from 'new' to 'open' |
From p5p@spam.wizbit.be
'# Deleting the undef makes it all work again!' [...]
Reduced the test case a bit more: Test case 1: Bizarre copy of ARRAY #!/usr/bin/perl my $args = [ "AAA" ]; $args = [ "BBB" ]; sub s2 { s1(@$args); Expected output: 'ARG: AAA' $ miniperl-5.000 rt-52610.pl $ miniperl-5.001 rt-52610.pl $ miniperl-perl-5.001n rt-52610.pl $ miniperl-5.002beta1 rt-52610.pl $ perl-5.8.8 rt-52610.pl => perl-5.000 outputs 'ARG: AAA' because closures were not yet Test case 2: copy $args before changing it #!/usr/bin/perl my $args = [ "AAA" ]; my $t = $args; sub s2 { s1(@$args); __END__ $ perl-5.8.8 rt-52610.pl Test case 3: Remove $h and $z #!/usr/bin/perl my $args = [ "AAA" ]; $args = [ "CCC" ]; sub s2 { s1(@$args); $ perl-5.8.0 rt-52610.pl $ perl-5.8.1 rt-52610.pl $ perl-5.8.8 rt-52610.pl Test case 4: use three hashes instead of a hash and a subroutine #!/usr/bin/perl my $args = [ "AAA" ]; $args = [ "BBB" ]; my $h = {}; s2(); sub s2 { s1(@$args); $ perl-5.8.8 rt-52610.pl Test case 5: Use: @foo2 = @DB::args #!/usr/bin/perl my $args = [ "AAA" ]; $args = [ "BBB" ]; sub s2 { s1(@$args); $ perl-5.8.6 rt-52610.pl $ perl-5.8.7 rt-52610.pl $ perl-5.8.8 rt-52610.pl Kind regards, Bram |
From p5p@spam.wizbit.beAnother test case: #!/usr/bin/perl my @args = 1 .. 10; sub s2 { $ perl-5.8.8 rt-52610.pl What happens is that the array is placed on the stack, then sub s1 is Then caller() access the stack and (I assume!) stores/aliasses all Kind regards, Bram |
1 similar comment
From p5p@spam.wizbit.beAnother test case: #!/usr/bin/perl my @args = 1 .. 10; sub s2 { $ perl-5.8.8 rt-52610.pl What happens is that the array is placed on the stack, then sub s1 is Then caller() access the stack and (I assume!) stores/aliasses all Kind regards, Bram |
From p5p@spam.wizbit.beOne more thought: caller and @DB::args aren't really nessesary to show #!/usr/bin/perl -l my @args = 1 .. 10; If nothing in sub s1() access @_ then this is a 'silent' bug. The real fix is to make the stack do ref counting.. This information would be more useful and allows for the problem to be Any thoughts? Kind regards, Bram |
From nadim@khemir.netCan also generate these error message: Bizarre copy of ARRAY in sassign at panic: attempt to copy freed scalar 1ad5ac0 to 1ccee98 at Bizarre copy of HASH in sassign at as reported in https://rt.cpan.org/Ticket/Display.html?id=55179 |
From rabbit@thesaurusCreated by rabbit@thesaurus.(none)I finally managed to reroduce the Test:: related failures that for pv in $(perlbrew installed | grep '^5') ; do perlbrew switch $pv ; perl perlfail.t &> $pv.log ; done Cheers! Perl Info
|
From @ribasushiTest and logs |
From @ribasushi |
From @ribasushi |
From @ribasushi |
From @ribasushi#!/usr/bin/perl ############################################################### use strict; { use Carp; sub diaf { shift->d ('Croaking croaker croaked') } sub wiaf { shift->w ( 'Carping carper carped') } use Test::More qw/no_plan/; my $max = 8; for (1 .. $max) { # test without quoting labels warning_like ( for (1 .. $max) { # Just for debugging purposes, removing it doesn't END { |
From @ribasushi |
From @ribasushi |
From @ribasushiMore fail. I aplogize for the duplication, didn't realize there was an http://rt.perl.org/rt3/Ticket/Display.html?id=76496 |
From @ribasushiAnd of course it turns out bug is real and reported for quite some time. http://rt.perl.org/rt3/Ticket/Display.html?id=52610 |
The RT System itself - Status changed from 'new' to 'open' |
From @ribasushiOn Tue Jul 13 20:10:42 2010, ribasushi wrote:
Hmmm... after reading the explanations on all previous tickets, I |
From @ribasushi |
From @ribasushi |
From @ribasushi |
From @ribasushi |
From @ribasushi#!/usr/bin/perl use strict; { use Carp; sub diaf { croak ('Croaking croaker croaked') } use Test::More qw/no_plan/; for my $x (1 .. 5) { throws_ok (sub { Tst::Croaker->diaf }, qr/croaked/, "throws exception"); # Just for log-tagging purposes, removing it doesn't END { |
From @ribasushi |
From @nwc10On Fri, Jul 16, 2010 at 12:32:02AM -0700, rabbit+bugs@rabbit.us via RT wrote:
It's a shame that the tickets were merged (but I would have done it too). Bug 76496 is actually a bug in Test::Exception. Could you report it there, with this patch to fix it: Inline Patch--- lib/Test/Exception.pm~ 2010-01-12 06:31:23.000000000 +0000
+++ lib/Test/Exception.pm 2010-07-17 11:41:50.000000000 +0100
@@ -85,11 +85,23 @@
sub _quiet_caller (;$) { ## no critic Prototypes
my $height = $_[0];
$height++;
- if( wantarray and !@_ ) {
- return (CORE::caller($height))[0..2];
+ if ( CORE::caller() eq 'DB' ) {
+ # passthrough the @DB::args trick
+ package DB;
+ if( wantarray and !@_ ) {
+ return (CORE::caller($height))[0..2];
+ }
+ else {
+ return CORE::caller($height);
+ }
}
else {
- return CORE::caller($height);
+ if( wantarray and !@_ ) {
+ return (CORE::caller($height))[0..2];
+ }
+ else {
+ return CORE::caller($height);
+ }
}
}
Result - @DB::args is stale - it's referring to the state of @_ from some for $x (1 .. 1) { [which has been subsequently re-used for the string "Regexp" inside qr//, and I suspect that the core docs for caller need to be updated to warn that if you I have a feeling of déjà vu here. Did some other module that overrides caller Nicholas Clark |
From @xdgOn Sat, Jul 17, 2010 at 6:51 AM, Nicholas Clark <nick@ccl4.org> wrote:
Sub::Uplevel implemented support for DB about two years ago. -- David |
From @ribasushiOn Sat Jul 17 03:51:32 2010, nicholas wrote:
Nicholas++ Bug reported https://rt.cpan.org/Ticket/Display.html?id=55179#txn-805481 I also looked at Test::Warn but it looks *much* simpler and does nto Thank you all! |
From @ribasushiOn Sat Jul 17 03:51:32 2010, nicholas wrote:
Just for completeness sake I'm announcing that the latest |
From @autarchThis no longer manifests in the same way. The attached code now ends up This is somewhat of an improvement, perhaps. |
From douglasg.wilson@gmail.comOn Tue Apr 15 02:53:34 2008, nicholas wrote:
Please, please can we get Carp patched with: @args = map { Then at least Carp will report useful errors. Carp should be |
Migrated from rt.perl.org#52610 (status was 'open')
Searchable as RT52610$
The text was updated successfully, but these errors were encountered: