From: Marc Girod on
Hi,

Debugging some problems I had (with map), I got extra errors under the
debugger, while trying to step around calls to warn:

Bizarre copy of ARRAY in sassign at /usr/lib/perl5/5.10/Carp/Heavy.pm
line 104, <GEN1> line 1.

Carp::caller_info(/usr/lib/perl5/5.10/Carp/Heavy.pm:104):
104: my $arg = shift;
DB<10> x @_
Bizarre copy of ARRAY in leaveeval at /usr/lib/perl5/5.10/perl5db.pl
line 638, <GEN1> line 1.

The first occurrence was still under my using 'map'.
I see that Carp itself uses a DB package.
Can there be that it conflicts with the debugger?

The second occurrence happened after I had switched my using map for
grep, and got the expected behaviour without the debugger.

I couldn't narrow the problem down yet.

Thanks,
Marc
From: Ben Morrow on

Quoth Marc Girod <marc.girod(a)gmail.com>:
>
> Debugging some problems I had (with map), I got extra errors under the
> debugger, while trying to step around calls to warn:
>
> Bizarre copy of ARRAY in sassign at /usr/lib/perl5/5.10/Carp/Heavy.pm
> line 104, <GEN1> line 1.
>
> Carp::caller_info(/usr/lib/perl5/5.10/Carp/Heavy.pm:104):
> 104: my $arg = shift;
> DB<10> x @_
> Bizarre copy of ARRAY in leaveeval at /usr/lib/perl5/5.10/perl5db.pl
> line 638, <GEN1> line 1.

This is a bug in perl, or in the debugger. I'm not terribly surprised:
@_ is deeply weird (especially when you've 'shift'ed it), and the
debugger is deeply weird; mix the two and presto! you get bugs :(. (Carp
uses some of the debugger hooks internally, so it's not surprising it
hits some of the same bugs.)

If you need a solution you could try upgrading to 5.12.1, to see if it's
been fixed; you could also try searching http://rt.perl.org/rt3/Public/
for a known bug. It may be worth reporting a new bug if you don't find
one that matches, especially if you've got a really simple testcase.

http://rt.perl.org/rt3/Public/Bug/Display.html?id=52610 looks like your
Carp error; it is unfixed, and appears to fall into the general category
of 'perl's stack isn't refcounted' bugs, which are unfortunately more
common that they should be and extremely difficult to fix (without
breaking half the XS in existence).

Ben

From: C.DeRykus on
On Jul 16, 10:10 am, Ben Morrow <b...(a)morrow.me.uk> wrote:
> Quoth Marc Girod <marc.gi...(a)gmail.com>:
>
>
>
> > Debugging some problems I had (with map), I got extra errors under the
> > debugger, while trying to step around calls to warn:
>
> > Bizarre copy of ARRAY in sassign at /usr/lib/perl5/5.10/Carp/Heavy.pm
> > line 104, <GEN1> line 1.
>
> > Carp::caller_info(/usr/lib/perl5/5.10/Carp/Heavy.pm:104):
> > 104:         my $arg = shift;
> >   DB<10> x @_
> > Bizarre copy of ARRAY in leaveeval at /usr/lib/perl5/5.10/perl5db.pl
> > line 638, <GEN1> line 1.
>
> This is a bug in perl, or in the debugger. I'm not terribly surprised:
> @_ is deeply weird (especially when you've 'shift'ed it), and the
> debugger is deeply weird; mix the two and presto! you get bugs :(. (Carp
> uses some of the debugger hooks internally, so it's not surprising it
> hits some of the same bugs.)
>
> If you need a solution you could try upgrading to 5.12.1, to see if it's
> been fixed; you could also try searchinghttp://rt.perl.org/rt3/Public/
> for a known bug. It may be worth reporting a new bug if you don't find
> one that matches, especially if you've got a really simple testcase.
>
> http://rt.perl.org/rt3/Public/Bug/Display.html?id=52610looks like your
> Carp error; it is unfixed, and appears to fall into the general category
> of 'perl's stack isn't refcounted' bugs, which are unfortunately more
> common that they should be and extremely difficult to fix (without
> breaking half the XS in existence).


A google P5P thread cites this example below.
Pending a fix, a workaround should be possible
in some cases:

use diagnostics;
my @x = 1 .. 10;
sub s1 {
@x = (); # don't do this now!
my $x = qr/a/;
for (@_) {
s2($_);
}
}
sub s2 {
my $y = shift; # error here
print $y;
}

s1(@x);
__END__

(P) Perl detected an attempt to copy an internal value that
is not copyable.
Bizarre copy of ARRAY in sassign ...


--
Charles DeRykus
From: Marc Girod on
On Jul 16, 7:09 pm, "C.DeRykus" <dery...(a)gmail.com> wrote:

> > This is a bug in perl, or in the debugger. I'm not terribly surprised:
....
> A google P5P thread cites this example below.

Thanks to both of you.
I don't need a fix: it is enough for me to have some reason to trust
my own code (who said I have few?).

And I couldn't narrow my problem into a neat case.

Marc