Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters

[perl #52610] Bizarre copy of ARRAY in sassign at Carp/Heavy.pm

 

 

Perl porters RSS feed   Index | Next | Previous | View Threaded


perlbug-followup at perl

Apr 8, 2008, 11:39 AM

Post #1 of 2 (640 views)
Permalink
[perl #52610] Bizarre copy of ARRAY in sassign at Carp/Heavy.pm

# New Ticket Created by Chris Heath
# Please include the string: [perl #52610]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=52610 >


This is a bug report for perl from chris [at] heathens,
generated with the help of perlbug 1.35 running under perl v5.8.8.


-----------------------------------------------------------------

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 {
print Carp::longmess;
}

sub call_with_args {
my ($arg_hash, $func) = @_;
$func->(@{$arg_hash->{'args'}});
}

my $h = {};
# Deleting the undef makes it all work again!
my $arg_hash = {'args' => [undef]};
call_with_args($arg_hash, sub {
$arg_hash->{'args'} = [];
do_carp(sub { $h; });
});


-----------------------------------------------------------------
---
Flags:
category=core
severity=low
---
This perlbug was built using Perl v5.8.8 in the Red Hat build system.
It is being executed now by Perl v5.8.8 - Thu Jan 31 13:32:29 EST 2008.

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:
Platform:
osname=linux, osvers=2.6.18-53.1.4.el5.bz358661.1, archname=i386-linux-thread-multi
uname='linux hammer2.fedora.redhat.com 2.6.18-53.1.4.el5.bz358661.1 #1 smp tue dec 18 14:48:27 est 2007 i686 athlon i386 gnulinux '
config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Dversion=5.8.8 -Dmyhostname=localhost -Dperladmin=root [at] localhos -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dinc_version_list=5.8.7 5.8.6 5.8.5 -Dscriptdir=/usr/bin'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='4.1.2 20070925 (Red Hat 4.1.2-27)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.6.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.6'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -L/usr/local/lib'

Locally applied patches:


---
@INC for perl v5.8.8:
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8
/usr/lib/perl5/site_perl/5.8.7
/usr/lib/perl5/site_perl/5.8.6
/usr/lib/perl5/site_perl/5.8.5
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.8
/usr/lib/perl5/vendor_perl/5.8.7
/usr/lib/perl5/vendor_perl/5.8.6
/usr/lib/perl5/vendor_perl/5.8.5
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/5.8.8
.

---
Environment for perl v5.8.8:
HOME=/home/chris
LANG=en_NZ.UTF-8
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/home/chris/bin:/sbin:/usr/sbin:/usr/local/sbin
PERL_BADLANG (unset)
SHELL=/bin/bash


nick at ccl4

Apr 15, 2008, 2:52 AM

Post #2 of 2 (585 views)
Permalink
Re: [perl #52610] Bizarre copy of ARRAY in sassign at Carp/Heavy.pm [In reply to]

On Tue, Apr 08, 2008 at 11:39:25AM -0700, Chris Heath wrote:

> 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 {
> print Carp::longmess;
> }
>
> sub call_with_args {
> my ($arg_hash, $func) = @_;
> $func->(@{$arg_hash->{'args'}});
> }
>
> my $h = {};
> # Deleting the undef makes it all work again!
> my $arg_hash = {'args' => [undef]};
> call_with_args($arg_hash, sub {
> $arg_hash->{'args'} = [];
> do_carp(sub { $h; });
> });

Thanks for this bug report. The error has been seen before, but not with this
concise a test case. I can reduce it down to this:

$ cat C.pm
package C;
sub longmess_real {
package DB;
() = caller(2);

use Devel::Peek; Dump \@DB::args;

foreach(@DB::args) {
my $a = $_;
}
}

1;
__END__
$ cat 52610
sub longmess {
require C;
goto &C::longmess_real;
}

sub do_carp {
longmess;
}

sub call_with_args {
my ($arg_hash, $func) = @_;
$func->(@{$arg_hash->{'args'}});
}

my $h = {};
# Deleting the undef makes it all work again!
my $arg_hash = {'args' => [undef]};
call_with_args($arg_hash, sub {
$arg_hash->{'args'} = [];
do_carp(sub { $h; });
});
__END__
$ ./perl -Ilib 52610
SV = IV(0x10081d9a0) at 0x10081d9a8
REFCNT = 1
FLAGS = (TEMP,ROK)
RV = 0x10081dbd0
SV = PVAV(0x1008059e8) at 0x10081dbd0
REFCNT = 2
FLAGS = ()
ARRAY = 0x10050b538
FILL = 0
MAX = 3
ARYLEN = 0x0
FLAGS = ()
Elt No. 0
SV = PVAV(0x100805808) at 0x10081d738
REFCNT = 1
FLAGS = ()
ARRAY = 0x10050b4c8
FILL = 1
MAX = 3
ARYLEN = 0x0
FLAGS = (REAL)
Elt No. 0
Elt No. 1
SV = PVNV(0x100802f18) at 0x10081d828
REFCNT = 2
FLAGS = (POK,FAKE,pPOK)
IV = 0
NV = 1.97626258336499e-323
PV = 0x10050d2f8 "$h"\0
CUR = 2
LEN = 8
Bizarre copy of ARRAY in sassign at C.pm line 9.

[the line with Devel::Peek is optional]

It looks like the address of something on Perl's stack ends up being re-used
as something (else) that points into a PAD. I'm not entirely sure why, and
it's something "special" with how caller and package DB interact.

Nicholas Clark

Perl porters RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.