Skip to content
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

Perl 5.10.0 segfaults on Format with my variables #9219

Closed
p5pRT opened this issue Feb 4, 2008 · 11 comments
Closed

Perl 5.10.0 segfaults on Format with my variables #9219

p5pRT opened this issue Feb 4, 2008 · 11 comments

Comments

@p5pRT
Copy link

p5pRT commented Feb 4, 2008

Migrated from rt.perl.org#50528 (status was 'resolved')

Searchable as RT50528$

@p5pRT
Copy link
Author

p5pRT commented Feb 4, 2008

From springl-perlbug@bfw-online.de

Created by springl-perlbug@bfw-online.de

Hi!

Thank you for your work on perl. Unfortunately, perl 5.10.0 segfaults on
the following program​:

==============================================
sub f ($); # Comment out to get right result!
sub f ($) {
  my $test = $_[0];
  write;
  format STDOUT =
@​<<<<<<<
$test
.
}
f(1);
f(2);

The problem is in the write statement. It only shows up in functions with
a pre-declared prototype that use lexical variables in formats. Former perl
versions (tested through 5.8.8) had a different problem​: They will will
output "1" for f(1) as well as for f(2).

Perl Info

Flags:
     category=core
     severity=high

Site configuration information for perl 5.10.0:

Configured by springl at Mon Feb  4 15:06:18 CET 2008.

Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
   Platform:
     osname=linux, osvers=2.6.23-1-686-bigmem, archname=i686-linux
     uname='linux debian.bfw.de 2.6.23-1-686-bigmem #1 smp sun dec 23 21:43:22 cet 2007 i686 gnulinux '
     config_args=''
     hint=recommended, useposix=true, d_sigaction=define
     useithreads=undef, usemultiplicity=undef
     useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
     use64bitint=undef, use64bitall=undef, uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
     optimize='-O2',
     cppflags='-fno-strict-aliasing -pipe -I/usr/local/include'
     ccversion='', gccversion='4.2.3 (Debian 4.2.3-1)', 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='cc', ldflags =' -L/usr/local/lib'
     libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64
     libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
     libc=/lib/libc-2.7.so, so=so, useshrplib=false, libperl=libperl.a
     gnulibc_version='2.7'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
     cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib'

Locally applied patches:



@INC for perl 5.10.0:
     /tmp/p/lib/perl5/5.10.0/i686-linux
     /tmp/p/lib/perl5/5.10.0
     /tmp/p/lib/perl5/site_perl/5.10.0/i686-linux
     /tmp/p/lib/perl5/site_perl/5.10.0
     .


Environment for perl 5.10.0:
     HOME=/home/springl
     LANG (unset)
     LANGUAGE (unset)
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
     PATH=/tmp/p/bin:/home/springl/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
     PERL_BADLANG (unset)
     SHELL=/bin/bash

Complete configuration data for perl 5.10.0:

Author=''
CONFIG='true'
Date='$Date'
Header=''
Id='$Id'
Locker=''
Log='$Log'
Mcc='Mcc'
PATCHLEVEL='10'
PERL_API_REVISION='5'
PERL_API_SUBVERSION='0'
PERL_API_VERSION='10'
PERL_CONFIG_SH='true'
PERL_REVISION='5'
PERL_SUBVERSION='0'
PERL_VERSION='10'
RCSfile='$RCSfile'
Revision='$Revision'
SUBVERSION='0'
Source=''
State=''
_a='.a'
_exe=''
_o='.o'
afs='false'
afsroot='/afs'
alignbytes='4'
ansi2knr=''
aphostname='/bin/hostname'
api_revision='5'
api_subversion='0'
api_version='10'
api_versionstring='5.10.0'
ar='ar'
archlib='/tmp/p/lib/perl5/5.10.0/i686-linux'
archlibexp='/tmp/p/lib/perl5/5.10.0/i686-linux'
archname='i686-linux'
archname64=''
archobjs=''
asctime_r_proto='0'
awk='awk'
baserev='5.0'
bash=''
bin='/tmp/p/bin'
binexp='/tmp/p/bin'
bison='bison'
byacc='byacc'
byteorder='1234'
c=''
castflags='0'
cat='cat'
cc='cc'
cccdlflags='-fPIC'
ccdlflags='-Wl,-E'
ccflags='-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
ccflags_nolargefiles='-fno-strict-aliasing -pipe -I/usr/local/include '
ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
ccname='gcc'
ccsymbols=''
ccversion=''
cf_by='springl'
cf_email='springl@debian.bfw.de'
cf_time='Mon Feb  4 15:06:18 CET 2008'
chgrp=''
chmod='chmod'
chown=''
clocktype='clock_t'
comm='comm'
compress=''
config_arg0='./Configure'
config_argc='0'
config_args=''
contains='grep'
cp='cp'
cpio=''
cpp='cpp'
cpp_stuff='42'
cppccsymbols=''
cppflags='-fno-strict-aliasing -pipe -I/usr/local/include'
cpplast='-'
cppminus='-'
cpprun='cc -E'
cppstdin='cc -E'
cppsymbols='_FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE=1 _POSIX_C_SOURCE=200112L _POSIX_SOURCE=1 __CHAR_BIT__=8 __DBL_DENORM_MIN__=4.9406564584124654e-324 __DBL_DIG__=15 __DBL_EPSILON__=2.2204460492503131e-16 __DBL_HAS_DENORM__=1 __DBL_HAS_INFINITY__=1 __DBL_HAS_QUIET_NAN__=1 __DBL_MANT_DIG__=53 __DBL_MAX_10_EXP__=308 __DBL_MAX_EXP__=1024 __DBL_MAX__=1.7976931348623157e+308 __DBL_MIN_10_EXP__=(-307) __DBL_MIN_EXP__=(-1021) __DBL_MIN__=2.2250738585072014e-308 __DEC128_DEN__=0.000000000000000000000000000000001E-6143DL __DEC128_EPSILON__=1E-33DL __DEC128_MANT_DIG__=34 __DEC128_MAX_EXP__=6144 __DEC128_MAX__=9.999999999999999999999999999999999E6144DL __DEC128_MIN_EXP__=(-6143) __DEC128_MIN__=1E-6143DL __DEC32_DEN__=0.000001E-95DF __DEC32_EPSILON__=1E-6DF __DEC32_MANT_DIG__=7 __DEC32_MAX_EXP__=96 __DEC32_MAX__=9.999999E96DF __DEC32_MIN_EXP__=(-95) __DEC32_MIN__=1E-95DF __DEC64_DEN__=0.000000000000001E-383DD __DEC64_EPSILON__=1E-15DD __DEC64_MANT_DIG__=16 __DEC64_MAX_EXP__=384 __DEC64_MAX__=9.999999999999999E384DD __DEC64_MIN_EXP__=(-383) __DEC64_MIN__=1E-383DD __DECIMAL_DIG__=21 __DEC_EVAL_METHOD__=2 __ELF__=1 __FINITE_MATH_ONLY__=0 __FLT_DENORM_MIN__=1.40129846e-45F __FLT_DIG__=6 __FLT_EPSILON__=1.19209290e-7F __FLT_EVAL_METHOD__=2 __FLT_HAS_DENORM__=1 __FLT_HAS_INFINITY__=1 __FLT_HAS_QUIET_NAN__=1 __FLT_MANT_DIG__=24 __FLT_MAX_10_EXP__=38 __FLT_MAX_EXP__=128 __FLT_MAX__=3.40282347e+38F __FLT_MIN_10_EXP__=(-37) __FLT_MIN_EXP__=(-125) __FLT_MIN__=1.17549435e-38F __FLT_RADIX__=2 __GLIBC_MINOR__=7 __GLIBC__=2 __GNUC_GNU_INLINE__=1 __GNUC_MINOR__=2 __GNUC_PATCHLEVEL__=3 __GNUC__=4 __GNU_LIBRARY__=6 __GXX_ABI_VERSION=1002 __INTMAX_MAX__=9223372036854775807LL __INTMAX_TYPE__=long\ long\ int __INT_MAX__=2147483647 __LDBL_DENORM_MIN__=3.64519953188247460253e-4951L __LDBL_DIG__=18 __LDBL_EPSILON__=1.08420217248550443401e-19L __LDBL_HAS_DENORM__=1 __LDBL_HAS_INFINITY__=1 __LDBL_HAS_QUIET_NAN__=1 __LDBL_MANT_DIG__=64 __LDBL_MAX_10_EXP__=4932 __LDBL_MAX_EXP__=16384 __LDBL_MAX__=1.18973149535723176502e+4932L __LDBL_MIN_10_EXP__=(-4931) __LDBL_MIN_EXP__=(-16381) __LDBL_MIN__=3.36210314311209350626e-4932L __LONG_LONG_MAX__=9223372036854775807LL __LONG_MAX__=2147483647L __PTRDIFF_TYPE__=int __REGISTER_PREFIX__= __SCHAR_MAX__=127 __SHRT_MAX__=32767 __SIZE_TYPE__=unsigned\ int __STDC_HOSTED__=1 __STDC__=1 __UINTMAX_TYPE__=long\ long\ unsigned\ int __USER_LABEL_PREFIX__= __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_POSIX=1 __USE_SVID=1 __VERSION__="4.2.3\ (Debian\ 4.2.3-1)" __WCHAR_MAX__=2147483647 __WCHAR_TYPE__=int __WINT_TYPE__=unsigned\ int __gnu_linux__=1 __i386=1 __i386__=1 __i486=1 __i486__=1 __linux=1 __linux__=1 __unix=1 __unix__=1 i386=1 linux=1 unix=1'
crypt_r_proto='0'
cryptlib=''
csh='csh'
ctermid_r_proto='0'
ctime_r_proto='0'
d_Gconvert='gcvt((x),(n),(b))'
d_PRIEUldbl='define'
d_PRIFUldbl='define'
d_PRIGUldbl='define'
d_PRIXU64='define'
d_PRId64='define'
d_PRIeldbl='define'
d_PRIfldbl='define'
d_PRIgldbl='define'
d_PRIi64='define'
d_PRIo64='define'
d_PRIu64='define'
d_PRIx64='define'
d_SCNfldbl='define'
d__fwalk=''
d_access='define'
d_accessx=''
d_aintl=''
d_alarm='define'
d_archlib='define'
d_asctime_r=''
d_atolf=''
d_atoll='define'
d_attribute_format='define'
d_attribute_malloc='define'
d_attribute_nonnull='define'
d_attribute_noreturn='define'
d_attribute_pure='define'
d_attribute_unused='define'
d_attribute_warn_unused_result='define'
d_bcmp='define'
d_bcopy='define'
d_bsd=''
d_bsdgetpgrp=''
d_bsdsetpgrp=''
d_builtin_choose_expr='define'
d_builtin_expect=''
d_bzero='define'
d_c99_variadic_macros='define'
d_casti32=''
d_castneg='define'
d_charvspr=''
d_chown='define'
d_chroot='define'
d_chsize=''
d_class=''
d_clearenv='define'
d_closedir='define'
d_cmsghdr_s='define'
d_const='define'
d_copysignl='define'
d_cplusplus=''
d_crypt='define'
d_crypt_r=''
d_csh='define'
d_ctermid='define'
d_ctermid_r=''
d_ctime_r=''
d_cuserid='define'
d_dbl_dig='define'
d_dbminitproto=''
d_difftime='define'
d_dir_dd_fd=''
d_dirfd='define'
d_dirnamlen=''
d_dlerror='define'
d_dlopen='define'
d_dlsymun=''
d_dosuid='define'
d_drand48_r=''
d_drand48proto='define'
d_dup2='define'
d_eaccess='define'
d_endgrent='define'
d_endgrent_r=''
d_endhent='define'
d_endhostent_r=''
d_endnent='define'
d_endnetent_r=''
d_endpent='define'
d_endprotoent_r=''
d_endpwent='define'
d_endpwent_r=''
d_endsent='define'
d_endservent_r=''
d_eofnblk='define'
d_eunice=''
d_faststdio=''
d_fchdir='define'
d_fchmod='define'
d_fchown='define'
d_fcntl='define'
d_fcntl_can_lock='define'
d_fd_macros='define'
d_fd_set='define'
d_fds_bits=''
d_fgetpos='define'
d_finite='define'
d_finitel='define'
d_flexfnam='define'
d_flock='define'
d_flockproto='define'
d_fork='define'
d_fp_class=''
d_fpathconf='define'
d_fpclass=''
d_fpclassify=''
d_fpclassl=''
d_fpos64_t=''
d_frexpl='define'
d_fs_data_s=''
d_fseeko='define'
d_fsetpos='define'
d_fstatfs='define'
d_fstatvfs='define'
d_fsync='define'
d_ftello='define'
d_ftime=''
d_futimes='define'
d_getcwd='define'
d_getespwnam=''
d_getfsstat=''
d_getgrent='define'
d_getgrent_r=''
d_getgrgid_r=''
d_getgrnam_r=''
d_getgrps='define'
d_gethbyaddr='define'
d_gethbyname='define'
d_gethent='define'
d_gethname='define'
d_gethostbyaddr_r=''
d_gethostbyname_r=''
d_gethostent_r=''
d_gethostprotos='define'
d_getitimer='define'
d_getlogin='define'
d_getlogin_r=''
d_getmnt=''
d_getmntent='define'
d_getnbyaddr='define'
d_getnbyname='define'
d_getnent='define'
d_getnetbyaddr_r=''
d_getnetbyname_r=''
d_getnetent_r=''
d_getnetprotos='define'
d_getpagsz='define'
d_getpbyname='define'
d_getpbynumber='define'
d_getpent='define'
d_getpgid='define'
d_getpgrp='define'
d_getpgrp2=''
d_getppid='define'
d_getprior='define'
d_getprotobyname_r=''
d_getprotobynumber_r=''
d_getprotoent_r=''
d_getprotoprotos='define'
d_getprpwnam=''
d_getpwent='define'
d_getpwent_r=''
d_getpwnam_r=''
d_getpwuid_r=''
d_getsbyname='define'
d_getsbyport='define'
d_getsent='define'
d_getservbyname_r=''
d_getservbyport_r=''
d_getservent_r=''
d_getservprotos='define'
d_getspnam='define'
d_getspnam_r=''
d_gettimeod='define'
d_gmtime_r=''
d_gnulibc='define'
d_grpasswd='define'
d_hasmntopt='define'
d_htonl='define'
d_ilogbl='define'
d_inc_version_list=''
d_index=''
d_inetaton='define'
d_int64_t='define'
d_isascii='define'
d_isfinite=''
d_isinf='define'
d_isnan='define'
d_isnanl='define'
d_killpg='define'
d_lchown='define'
d_ldbl_dig='define'
d_libm_lib_version='define'
d_link='define'
d_localtime_r=''
d_localtime_r_needs_tzset=''
d_locconv='define'
d_lockf='define'
d_longdbl='define'
d_longlong='define'
d_lseekproto='define'
d_lstat='define'
d_madvise='define'
d_malloc_good_size=''
d_malloc_size=''
d_mblen='define'
d_mbstowcs='define'
d_mbtowc='define'
d_memchr='define'
d_memcmp='define'
d_memcpy='define'
d_memmove='define'
d_memset='define'
d_mkdir='define'
d_mkdtemp='define'
d_mkfifo='define'
d_mkstemp='define'
d_mkstemps=''
d_mktime='define'
d_mmap='define'
d_modfl='define'
d_modfl_pow32_bug=''
d_modflproto='define'
d_mprotect='define'
d_msg='define'
d_msg_ctrunc='define'
d_msg_dontroute='define'
d_msg_oob='define'
d_msg_peek='define'
d_msg_proxy='define'
d_msgctl='define'
d_msgget='define'
d_msghdr_s='define'
d_msgrcv='define'
d_msgsnd='define'
d_msync='define'
d_munmap='define'
d_mymalloc=''
d_nice='define'
d_nl_langinfo='define'
d_nv_preserves_uv='define'
d_nv_zero_is_allbits_zero='define'
d_off64_t=''
d_old_pthread_create_joinable=''
d_oldpthreads=''
d_oldsock=''
d_open3='define'
d_pathconf='define'
d_pause='define'
d_perl_otherlibdirs=''
d_phostname=''
d_pipe='define'
d_poll='define'
d_portable='define'
d_printf_format_null='define'
d_procselfexe='define'
d_pseudofork=''
d_pthread_atfork=''
d_pthread_attr_setscope='define'
d_pthread_yield=''
d_pwage=''
d_pwchange=''
d_pwclass=''
d_pwcomment=''
d_pwexpire=''
d_pwgecos='define'
d_pwpasswd='define'
d_pwquota=''
d_qgcvt='define'
d_quad='define'
d_random_r=''
d_readdir='define'
d_readdir64_r=''
d_readdir_r=''
d_readlink='define'
d_readv='define'
d_recvmsg='define'
d_rename='define'
d_rewinddir='define'
d_rmdir='define'
d_safebcpy=''
d_safemcpy=''
d_sanemcmp='define'
d_sbrkproto='define'
d_scalbnl='define'
d_sched_yield='define'
d_scm_rights='define'
d_seekdir='define'
d_select='define'
d_sem='define'
d_semctl='define'
d_semctl_semid_ds='define'
d_semctl_semun='define'
d_semget='define'
d_semop='define'
d_sendmsg='define'
d_setegid='define'
d_seteuid='define'
d_setgrent='define'
d_setgrent_r=''
d_setgrps='define'
d_sethent='define'
d_sethostent_r=''
d_setitimer='define'
d_setlinebuf='define'
d_setlocale='define'
d_setlocale_r=''
d_setnent='define'
d_setnetent_r=''
d_setpent='define'
d_setpgid='define'
d_setpgrp='define'
d_setpgrp2=''
d_setprior='define'
d_setproctitle=''
d_setprotoent_r=''
d_setpwent='define'
d_setpwent_r=''
d_setregid='define'
d_setresgid='define'
d_setresuid='define'
d_setreuid='define'
d_setrgid=''
d_setruid=''
d_setsent='define'
d_setservent_r=''
d_setsid='define'
d_setvbuf='define'
d_sfio=''
d_shm='define'
d_shmat='define'
d_shmatprototype='define'
d_shmctl='define'
d_shmdt='define'
d_shmget='define'
d_sigaction='define'
d_signbit='define'
d_sigprocmask='define'
d_sigsetjmp='define'
d_sitearch='define'
d_snprintf='define'
d_sockatmark='define'
d_sockatmarkproto='define'
d_socket='define'
d_socklen_t='define'
d_sockpair='define'
d_socks5_init=''
d_sprintf_returns_strlen='define'
d_sqrtl='define'
d_srand48_r=''
d_srandom_r=''
d_sresgproto=''
d_sresuproto=''
d_statblks='define'
d_statfs_f_flags=''
d_statfs_s='define'
d_statvfs='define'
d_stdio_cnt_lval=''
d_stdio_ptr_lval=''
d_stdio_ptr_lval_nochange_cnt=''
d_stdio_ptr_lval_sets_cnt=''
d_stdio_stream_array=''
d_stdiobase=''
d_stdstdio=''
d_strchr='define'
d_strcoll='define'
d_strctcpy='define'
d_strerrm='strerror(e)'
d_strerror='define'
d_strerror_r=''
d_strftime='define'
d_strlcat=''
d_strlcpy=''
d_strtod='define'
d_strtol='define'
d_strtold='define'
d_strtoll='define'
d_strtoq='define'
d_strtoul='define'
d_strtoull='define'
d_strtouq='define'
d_strxfrm='define'
d_suidsafe=''
d_symlink='define'
d_syscall='define'
d_syscallproto='define'
d_sysconf='define'
d_sysernlst=''
d_syserrlst='define'
d_system='define'
d_tcgetpgrp='define'
d_tcsetpgrp='define'
d_telldir='define'
d_telldirproto='define'
d_time='define'
d_times='define'
d_tm_tm_gmtoff='define'
d_tm_tm_zone='define'
d_tmpnam_r=''
d_truncate='define'
d_ttyname_r=''
d_tzname='define'
d_u32align=''
d_ualarm='define'
d_umask='define'
d_uname='define'
d_union_semun=''
d_unordered=''
d_unsetenv='define'
d_usleep='define'
d_usleepproto='define'
d_ustat='define'
d_vendorarch=''
d_vendorbin=''
d_vendorlib=''
d_vendorscript=''
d_vfork=''
d_void_closedir=''
d_voidsig='define'
d_voidtty=''
d_volatile='define'
d_vprintf='define'
d_vsnprintf='define'
d_wait4='define'
d_waitpid='define'
d_wcstombs='define'
d_wctomb='define'
d_writev='define'
d_xenix=''
date='date'
db_hashtype='u_int32_t'
db_prefixtype='size_t'
db_version_major='4'
db_version_minor='4'
db_version_patch='20'
defvoidused='15'
direntrytype='struct dirent'
dlext='so'
dlsrc='dl_dlopen.xs'
doublesize='8'
drand01='drand48()'
drand48_r_proto='0'
dynamic_ext='B Compress/Raw/Zlib Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA Encode Fcntl File/Glob Filter/Util/Call GDBM_File Hash/Util I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Math/BigInt/FastCalc Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Text/Soundex Time/HiRes Time/Piece Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared Hash/Util/FieldHash'
eagain='EAGAIN'
ebcdic=''
echo='echo'
egrep='egrep'
emacs=''
endgrent_r_proto='0'
endhostent_r_proto='0'
endnetent_r_proto='0'
endprotoent_r_proto='0'
endpwent_r_proto='0'
endservent_r_proto='0'
eunicefix=':'
exe_ext=''
expr='expr'
extensions='B Compress/Raw/Zlib Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA Encode Fcntl File/Glob Filter/Util/Call GDBM_File Hash/Util I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Math/BigInt/FastCalc Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Text/Soundex Time/HiRes Time/Piece Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared Hash/Util/FieldHash Compress/Zlib Errno IO_Compress_Base IO_Compress_Zlib'
extras=''
fflushNULL='define'
fflushall=''
find=''
firstmakefile='makefile'
flex=''
fpossize='16'
fpostype='fpos_t'
freetype='void'
from=':'
full_ar='/usr/bin/ar'
full_csh='/bin/csh'
full_sed='/bin/sed'
gccansipedantic=''
gccosandvers=''
gccversion='4.2.3 (Debian 4.2.3-1)'
getgrent_r_proto='0'
getgrgid_r_proto='0'
getgrnam_r_proto='0'
gethostbyaddr_r_proto='0'
gethostbyname_r_proto='0'
gethostent_r_proto='0'
getlogin_r_proto='0'
getnetbyaddr_r_proto='0'
getnetbyname_r_proto='0'
getnetent_r_proto='0'
getprotobyname_r_proto='0'
getprotobynumber_r_proto='0'
getprotoent_r_proto='0'
getpwent_r_proto='0'
getpwnam_r_proto='0'
getpwuid_r_proto='0'
getservbyname_r_proto='0'
getservbyport_r_proto='0'
getservent_r_proto='0'
getspnam_r_proto='0'
gidformat='"lu"'
gidsign='1'
gidsize='4'
gidtype='gid_t'
glibpth='/usr/shlib  /lib /usr/lib /usr/lib/386 /lib/386 /usr/ccs/lib /usr/ucblib /usr/local/lib /lib64 /usr/lib64 /usr/local/lib64 '
gmake='gmake'
gmtime_r_proto='0'
gnulibc_version='2.7'
grep='grep'
groupcat='cat /etc/group'
groupstype='gid_t'
gzip='gzip'
h_fcntl='false'
h_sysfile='true'
hint='recommended'
hostcat='cat /etc/hosts'
html1dir=' '
html1direxp=''
html3dir=' '
html3direxp=''
i16size='2'
i16type='short'
i32size='4'
i32type='long'
i64size='8'
i64type='long long'
i8size='1'
i8type='char'
i_arpainet='define'
i_bsdioctl=''
i_crypt='define'
i_db='define'
i_dbm=''
i_dirent='define'
i_dld=''
i_dlfcn='define'
i_fcntl=''
i_float='define'
i_fp=''
i_fp_class=''
i_gdbm='define'
i_grp='define'
i_ieeefp=''
i_inttypes='define'
i_langinfo='define'
i_libutil=''
i_limits='define'
i_locale='define'
i_machcthr=''
i_malloc='define'
i_math='define'
i_memory=''
i_mntent='define'
i_ndbm=''
i_netdb='define'
i_neterrno=''
i_netinettcp='define'
i_niin='define'
i_poll='define'
i_prot=''
i_pthread='define'
i_pwd='define'
i_rpcsvcdbm=''
i_sfio=''
i_sgtty=''
i_shadow='define'
i_socks='define'
i_stdarg='define'
i_stddef='define'
i_stdlib='define'
i_string='define'
i_sunmath=''
i_sysaccess=''
i_sysdir='define'
i_sysfile='define'
i_sysfilio=''
i_sysin=''
i_sysioctl='define'
i_syslog='define'
i_sysmman='define'
i_sysmode=''
i_sysmount='define'
i_sysndir=''
i_sysparam='define'
i_sysresrc='define'
i_syssecrt=''
i_sysselct='define'
i_syssockio=''
i_sysstat='define'
i_sysstatfs='define'
i_sysstatvfs='define'
i_systime='define'
i_systimek=''
i_systimes='define'
i_systypes='define'
i_sysuio='define'
i_sysun='define'
i_sysutsname='define'
i_sysvfs='define'
i_syswait='define'
i_termio=''
i_termios='define'
i_time='define'
i_unistd='define'
i_ustat='define'
i_utime='define'
i_values='define'
i_varargs=''
i_varhdr='stdarg.h'
i_vfork=''
ignore_versioned_solibs='y'
inc_version_list=' '
inc_version_list_init='0'
incpath=''
inews=''
initialinstalllocation='/tmp/p/bin'
installarchlib='/tmp/p/lib/perl5/5.10.0/i686-linux'
installbin='/tmp/p/bin'
installhtml1dir=''
installhtml3dir=''
installman1dir='/tmp/p/man/man1'
installman3dir='/tmp/p/man/man3'
installprefix='/tmp/p'
installprefixexp='/tmp/p'
installprivlib='/tmp/p/lib/perl5/5.10.0'
installscript='y'
installsitearch='/tmp/p/lib/perl5/site_perl/5.10.0/i686-linux'
installsitebin='/tmp/p/bin'
installsitehtml1dir=''
installsitehtml3dir=''
installsitelib='/tmp/p/lib/perl5/site_perl/5.10.0'
installsiteman1dir='/tmp/p/man/man1'
installsiteman3dir='/tmp/p/man/man3'
installsitescript='/tmp/p/bin'
installstyle='lib/perl5'
installusrbinperl=''
installvendorarch=''
installvendorbin=''
installvendorhtml1dir=''
installvendorhtml3dir=''
installvendorlib=''
installvendorman1dir=''
installvendorman3dir=''
installvendorscript=''
intsize='4'
issymlink='test -h'
ivdformat='"ld"'
ivsize='4'
ivtype='long'
known_extensions='B Compress/Raw/Zlib Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA Encode Fcntl File/Glob Filter/Util/Call GDBM_File Hash/Util I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Math/BigInt/FastCalc NDBM_File ODBM_File Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Text/Soundex Time/HiRes Time/Piece Unicode/Normalize Win32 Win32API/File Win32CORE XS/APItest XS/Typemap attrs re threads threads/shared Hash/Util/FieldHash'
ksh=''
ld='cc'
lddlflags='-shared -O2 -L/usr/local/lib'
ldflags=' -L/usr/local/lib'
ldflags_nolargefiles=' -L/usr/local/lib'
ldflags_uselargefiles=''
ldlibpthname='LD_LIBRARY_PATH'
less='less'
lib_ext='.a'
libc='/lib/libc-2.7.so'
libdb_needs_pthread='N'
libperl='libperl.a'
libpth='/usr/local/lib /lib /usr/lib /lib64 /usr/lib64'
libs='-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc'
libs_nolargefiles='-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc'
libsdirs=' /usr/lib'
libsfiles=' libnsl.so libgdbm.so libdb.so libdl.so libm.so libcrypt.so libutil.so libc.so'
libsfound=' /usr/lib/libnsl.so /usr/lib/libgdbm.so /usr/lib/libdb.so /usr/lib/libdl.so /usr/lib/libm.so /usr/lib/libcrypt.so /usr/lib/libutil.so /usr/lib/libc.so'
libspath=' /usr/local/lib /lib /usr/lib /lib64 /usr/lib64'
libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun m crypt sec util c cposix posix ucb BSD'
libswanted_nolargefiles='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun m crypt sec util c cposix posix ucb BSD'
libswanted_uselargefiles=''
line=''
lint=''
lkflags=''
ln='ln'
lns='/bin/ln -s'
localtime_r_proto='0'
locincpth='/usr/local/include /opt/local/include /usr/gnu/include /opt/gnu/include /usr/GNU/include /opt/GNU/include'
loclibpth='/usr/local/lib /opt/local/lib /usr/gnu/lib /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib'
longdblsize='12'
longlongsize='8'
longsize='4'
lp=''
lpr=''
ls='ls'
lseeksize='8'
lseektype='off_t'
mad=''
madlyh=''
madlyobj=''
madlysrc=''
mail=''
mailx=''
make='make'
make_set_make='#'
mallocobj=''
mallocsrc=''
malloctype='void *'
man1dir='/tmp/p/man/man1'
man1direxp='/tmp/p/man/man1'
man1ext='1'
man3dir='/tmp/p/man/man3'
man3direxp='/tmp/p/man/man3'
man3ext='3'
mips_type=''
mistrustnm=''
mkdir='mkdir'
mmaptype='void *'
modetype='mode_t'
more='more'
multiarch=''
mv=''
myarchname='i686-linux'
mydomain='.bfw.de'
myhostname='debian'
myuname='linux debian.bfw.de 2.6.23-1-686-bigmem #1 smp sun dec 23 21:43:22 cet 2007 i686 gnulinux '
n='-n'
need_va_copy=''
netdb_hlen_type='size_t'
netdb_host_type='const void *'
netdb_name_type='const char *'
netdb_net_type='in_addr_t'
nm='nm'
nm_opt=''
nm_so_opt='--dynamic'
nonxs_ext='Compress/Zlib Errno IO_Compress_Base IO_Compress_Zlib'
nroff='nroff'
nvEUformat='"E"'
nvFUformat='"F"'
nvGUformat='"G"'
nv_preserves_uv_bits='32'
nveformat='"e"'
nvfformat='"f"'
nvgformat='"g"'
nvsize='8'
nvtype='double'
o_nonblock='O_NONBLOCK'
obj_ext='.o'
old_pthread_create_joinable=''
optimize='-O2'
orderlib='false'
osname='linux'
osvers='2.6.23-1-686-bigmem'
otherlibdirs=' '
package='perl5'
pager='/usr/bin/less'
passcat='cat /etc/passwd'
patchlevel='10'
path_sep=':'
perl=''
perl5='/usr/bin/perl'
perl_patchlevel=''
perladmin='springl@debian.bfw.de'
perllibs='-lnsl -ldl -lm -lcrypt -lutil -lc'
perlpath='/tmp/p/bin/perl'
pg='pg'
phostname='hostname'
pidtype='pid_t'
plibpth=''
pmake=''
pr=''
prefix='/tmp/p'
prefixexp='/tmp/p'
privlib='/tmp/p/lib/perl5/5.10.0'
privlibexp='/tmp/p/lib/perl5/5.10.0'
procselfexe='"/proc/self/exe"'
prototype='define'
ptrsize='4'
quadkind='3'
quadtype='long long'
randbits='48'
randfunc='drand48'
random_r_proto='0'
randseedtype='long'
ranlib=':'
rd_nodata='-1'
readdir64_r_proto='0'
readdir_r_proto='0'
revision='5'
rm='rm'
rm_try='/bin/rm -f try try a.out .out try.[cho] try..o core core.try* try.core*'
rmail=''
run=''
runnm='false'
sPRIEUldbl='"LE"'
sPRIFUldbl='"LF"'
sPRIGUldbl='"LG"'
sPRIXU64='"LX"'
sPRId64='"Ld"'
sPRIeldbl='"Le"'
sPRIfldbl='"Lf"'
sPRIgldbl='"Lg"'
sPRIi64='"Li"'
sPRIo64='"Lo"'
sPRIu64='"Lu"'
sPRIx64='"Lx"'
sSCNfldbl='"Lf"'
sched_yield='sched_yield()'
scriptdir='y'
scriptdirexp='y'
sed='sed'
seedfunc='srand48'
selectminbits='32'
selecttype='fd_set *'
sendmail=''
setgrent_r_proto='0'
sethostent_r_proto='0'
setlocale_r_proto='0'
setnetent_r_proto='0'
setprotoent_r_proto='0'
setpwent_r_proto='0'
setservent_r_proto='0'
sh='/bin/sh'
shar=''
sharpbang='#!'
shmattype='void *'
shortsize='2'
shrpenv=''
shsharp='true'
sig_count='65'
sig_name='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS NUM32 NUM33 RTMIN NUM35 NUM36 NUM37 NUM38 NUM39 NUM40 NUM41 NUM42 NUM43 NUM44 NUM45 NUM46 NUM47 NUM48 NUM49 NUM50 NUM51 NUM52 NUM53 NUM54 NUM55 NUM56 NUM57 NUM58 NUM59 NUM60 NUM61 NUM62 NUM63 RTMAX IOT CLD POLL UNUSED '
sig_name_init='"ZERO", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "BUS", "FPE", "KILL", "USR1", "SEGV", "USR2", "PIPE", "ALRM", "TERM", "STKFLT", "CHLD", "CONT", "STOP", "TSTP", "TTIN", "TTOU", "URG", "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "IO", "PWR", "SYS", "NUM32", "NUM33", "RTMIN", "NUM35", "NUM36", "NUM37", "NUM38", "NUM39", "NUM40", "NUM41", "NUM42", "NUM43", "NUM44", "NUM45", "NUM46", "NUM47", "NUM48", "NUM49", "NUM50", "NUM51", "NUM52", "NUM53", "NUM54", "NUM55", "NUM56", "NUM57", "NUM58", "NUM59", "NUM60", "NUM61", "NUM62", "NUM63", "RTMAX", "IOT", "CLD", "POLL", "UNUSED", 0'
sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 6 17 29 31 '
sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 6, 17, 29, 31, 0'
sig_size='69'
signal_t='void'
sitearch='/tmp/p/lib/perl5/site_perl/5.10.0/i686-linux'
sitearchexp='/tmp/p/lib/perl5/site_perl/5.10.0/i686-linux'
sitebin='/tmp/p/bin'
sitebinexp='/tmp/p/bin'
sitehtml1dir=''
sitehtml1direxp=''
sitehtml3dir=''
sitehtml3direxp=''
sitelib='/tmp/p/lib/perl5/site_perl/5.10.0'
sitelib_stem='/tmp/p/lib/perl5/site_perl'
sitelibexp='/tmp/p/lib/perl5/site_perl/5.10.0'
siteman1dir='/tmp/p/man/man1'
siteman1direxp='/tmp/p/man/man1'
siteman3dir='/tmp/p/man/man3'
siteman3direxp='/tmp/p/man/man3'
siteprefix='/tmp/p'
siteprefixexp='/tmp/p'
sitescript='/tmp/p/bin'
sitescriptexp='/tmp/p/bin'
sizesize='4'
sizetype='size_t'
sleep=''
smail=''
so='so'
sockethdr=''
socketlib=''
socksizetype='socklen_t'
sort='sort'
spackage='Perl5'
spitshell='cat'
srand48_r_proto='0'
srandom_r_proto='0'
src='.'
ssizetype='ssize_t'
startperl='#!/tmp/p/bin/perl'
startsh='#!/bin/sh'
static_ext=' '
stdchar='char'
stdio_base='((fp)->_IO_read_base)'
stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)'
stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
stdio_filbuf=''
stdio_ptr='((fp)->_IO_read_ptr)'
stdio_stream_array=''
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
subversion='0'
sysman='/usr/share/man/man1'
tail=''
tar=''
targetarch=''
tbl=''
tee=''
test='test'
timeincl='/usr/include/sys/time.h /usr/include/time.h '
timetype='time_t'
tmpnam_r_proto='0'
to=':'
touch='touch'
tr='tr'
trnl='\n'
troff=''
ttyname_r_proto='0'
u16size='2'
u16type='unsigned short'
u32size='4'
u32type='unsigned long'
u64size='8'
u64type='unsigned long long'
u8size='1'
u8type='unsigned char'
uidformat='"lu"'
uidsign='1'
uidsize='4'
uidtype='uid_t'
uname='uname'
uniq='uniq'
uquadtype='unsigned long long'
use5005threads=''
use64bitall=''
use64bitint=''
usecrosscompile=''
usedl='define'
usefaststdio=''
useithreads=''
uselargefiles='define'
uselongdouble=''
usemallocwrap='define'
usemorebits=''
usemultiplicity=''
usemymalloc='n'
usenm='false'
useopcode='true'
useperlio='define'
useposix='true'
usereentrant=''
userelocatableinc=''
usesfio='false'
useshrplib='false'
usesitecustomize=''
usesocks=''
usethreads=''
usevendorprefix=''
usevfork='false'
usrinc='/usr/include'
uuname=''
uvXUformat='"lX"'
uvoformat='"lo"'
uvsize='4'
uvtype='unsigned long'
uvuformat='"lu"'
uvxformat='"lx"'
vendorarch=''
vendorarchexp=''
vendorbin=''
vendorbinexp=''
vendorhtml1dir=' '
vendorhtml1direxp=''
vendorhtml3dir=' '
vendorhtml3direxp=''
vendorlib=''
vendorlib_stem=''
vendorlibexp=''
vendorman1dir=' '
vendorman1direxp=''
vendorman3dir=' '
vendorman3direxp=''
vendorprefix=''
vendorprefixexp=''
vendorscript=''
vendorscriptexp=''
version='5.10.0'
version_patchlevel_string='version 10 subversion 0'
versiononly=''
vi=''
voidflags='15'
xlibpth='/usr/lib/386 /lib/386'
yacc='yacc'
yaccflags=''
zcat=''
zip='zip'
-- 
Stephan Springl                           BFW Werner Völk GmbH
Mail:  springl-perlbug@bfw-online.de      Energiemesstechnik & Service

@p5pRT
Copy link
Author

p5pRT commented Feb 6, 2008

From @iabyn

On Mon, Feb 04, 2008 at 07​:22​:29AM -0800, Stephan Springl wrote​:

Thank you for your work on perl. Unfortunately, perl 5.10.0 segfaults on
the following program​:

==============================================
sub f ($); # Comment out to get right result!
sub f ($) {
my $test = $_[0];
write;
format STDOUT =
@​<<<<<<<
$test
.
}
f(1);
f(2);

Thanks for the concise test case.

P5Pers​:

The bug is due to the fact that in the presence of prototypes, after the
real sub is compiled, its body is physically copied across to a new CV,
which messes the CvOUTSIDE field of any child anon or format subs.
The anon subs are fixed up by looking through the parent's pad for any
'&' entries which point to the children that need fixing. There isn't a
similar way to find formats, so they can't be fixed up.

The two solutions seem to be​:

a) have pointers in parent pads to formats, or
b) rejig newATTRSUB in such a way that it doesn't have to do the
abomination of copying the CV body.

Don't really have time to look at this further yet.

--
"Strange women lying in ponds distributing swords is no basis for a system
of government. Supreme executive power derives from a mandate from the
masses, not from some farcical aquatic ceremony."
  -- Dennis, "Monty Python and the Holy Grail"

@p5pRT
Copy link
Author

p5pRT commented Feb 6, 2008

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented May 28, 2009

From @nwc10

Dave notes​:

a closure/format segfault in 5.10

@p5pRT
Copy link
Author

p5pRT commented Jun 25, 2009

From chromatic@wgz.org

On Tuesday 05 February 2008 16​:29​:12 Dave Mitchell wrote​:

The bug is due to the fact that in the presence of prototypes, after the
real sub is compiled, its body is physically copied across to a new CV,
which messes the CvOUTSIDE field of any child anon or format subs.
The anon subs are fixed up by looking through the parent's pad for any
'&' entries which point to the children that need fixing. There isn't a
similar way to find formats, so they can't be fixed up.

The two solutions seem to be​:

a) have pointers in parent pads to formats, or
b) rejig newATTRSUB in such a way that it doesn't have to do the
abomination of copying the CV body.

Don't really have time to look at this further yet.

I don't think b) is tractable. If anything's taken a reference to a sub
prototype, it points to the first CV. If you stuff a new CV (a properly mangled
PL_compcv, for example) in the GV (or wherever), you break at least an
AutoLoader test in the core, and some expectations elsewhere. My failed
attempt produced failures in​:

  ../ext/Math-BigInt-FastCalc/t/bigintfc.t
  ../lib/AutoLoader/t/01AutoLoader.t
  ../lib/Exporter.t
  ../lib/Math/BigInt/t/sub_mbf.t
  ../lib/bignum/t/bninfnan.t
  ../lib/bignum/t/brinfnan.t
  op/closure.t
  op/method.t

... along these lines​:

not ok 41
# Failed at t/op/method.t line 136
# got 'B​: In B​::e, 2'
# expected 'C​: In C​::e, 1'
not ok 42
# Failed at t/op/method.t line 138
# got 'B​: In A​::ee, 3'
# expected 'B​: In A​::ee, 2'
not ok 43
# Failed at t/op/method.t line 139
# got 'B​: In A​::ee, 3'
# expected 'B​: In A​::ee, 2'

-- c

@p5pRT
Copy link
Author

p5pRT commented Jun 26, 2009

From p5p@spam.wizbit.be

----Program----
#!/usr/bin/perl -l

sub f ($); # Comment out to get right result!
sub f ($) {
  my $test = $_[0];
  write;
  format STDOUT =
@​<<<<<<<
$test
.
}
f(1);
f(2);

----Output of .../pd2oePD/perl-5.8.0@​19648/bin/perl----
1
1

----EOF ($?='0')----
----Output of .../pKd6Hks/perl-5.8.0@​19649/bin/perl----

----EOF ($?='11')----

http​://perl5.git.perl.org/perl.git/commit/
71f882d
uthor Dave Mitchell <davem@​fdisolutions.com>
  Sat, 31 May 2003 19​:54​:48 +0000 (20​:54 +0100)
committer Rafael Garcia-Suarez <rgarciasuarez@​gmail.com>
  Sat, 31 May 2003 18​:33​:07 +0000 (18​:33 +0000)
commit 71f882d
tree aec07a1ff1cac538c9b9c2426fbb4b427a03e341 tree | snapshot
parent 0aeb64d commit | diff

jumbo closure patch broke formats
Message-ID​: <20030531185448.GA6055@​fdgroup.com>
Plus restore the original test script for bug #22372

p4raw-id​: //depot/perl@​19649

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2009

From andy@hexten.net

On Thu Jun 25 14​:50​:51 2009, chromatic@​wgz.org wrote​:

On Tuesday 05 February 2008 16​:29​:12 Dave Mitchell wrote​:

The bug is due to the fact that in the presence of prototypes, after
the
real sub is compiled, its body is physically copied across to a new
CV,
which messes the CvOUTSIDE field of any child anon or format subs.
The anon subs are fixed up by looking through the parent's pad for
any
'&' entries which point to the children that need fixing. There
isn't a
similar way to find formats, so they can't be fixed up.

The two solutions seem to be​:

a) have pointers in parent pads to formats, or
b) rejig newATTRSUB in such a way that it doesn't have to do the
abomination of copying the CV body.

Don't really have time to look at this further yet.

I don't think b) is tractable. If anything's taken a reference to a
sub
prototype, it points to the first CV. If you stuff a new CV (a
properly mangled
PL_compcv, for example) in the GV (or wherever), you break at least an
AutoLoader test in the core, and some expectations elsewhere. My
failed
attempt produced failures in​:

    \.\./ext/Math\-BigInt\-FastCalc/t/bigintfc\.t
    \.\./lib/AutoLoader/t/01AutoLoader\.t
    \.\./lib/Exporter\.t
    \.\./lib/Math/BigInt/t/sub\_mbf\.t
    \.\./lib/bignum/t/bninfnan\.t
    \.\./lib/bignum/t/brinfnan\.t
    op/closure\.t
    op/method\.t

... along these lines​:

not ok 41
# Failed at t/op/method.t line 136
# got 'B​: In B​::e, 2'
# expected 'C​: In C​::e, 1'
not ok 42
# Failed at t/op/method.t line 138
# got 'B​: In A​::ee, 3'
# expected 'B​: In A​::ee, 2'
not ok 43
# Failed at t/op/method.t line 139
# got 'B​: In A​::ee, 3'
# expected 'B​: In A​::ee, 2'

What happens if we don't throw away the newly compiled sub after copying it into the
prototype? That seems to solve the dangling reference problem but I have no idea what else
it might break. The naive test I just did does indeed make the test case behave - but causes
other breakage. But that may just be because I'm not quite sure which refcounts I need to
bump.

@p5pRT
Copy link
Author

p5pRT commented Dec 14, 2009

From zefram@fysh.org

I wrote​:

Attached patch fixes bug #22977. make regen_perly after applying.

Should also fix bug #50528, apparently a duplicate.

-zefram

@p5pRT
Copy link
Author

p5pRT commented Dec 15, 2009

@rgs - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this as completed Dec 15, 2009
@p5pRT
Copy link
Author

p5pRT commented Jun 28, 2012

From @cpansprout

On Tue Feb 05 16​:33​:41 2008, davem wrote​:

On Mon, Feb 04, 2008 at 07​:22​:29AM -0800, Stephan Springl wrote​:

Thank you for your work on perl. Unfortunately, perl 5.10.0
segfaults on
the following program​:

==============================================
sub f ($); # Comment out to get right result!
sub f ($) {
my $test = $_[0];
write;
format STDOUT =
@​<<<<<<<
$test
.
}
f(1);
f(2);

Thanks for the concise test case.

That was actually your own test case, from #22977. :-)

P5Pers​:

The bug is due to the fact that in the presence of prototypes, after the
real sub is compiled, its body is physically copied across to a new CV,
which messes the CvOUTSIDE field of any child anon or format subs.
The anon subs are fixed up by looking through the parent's pad for any
'&' entries which point to the children that need fixing. There isn't a
similar way to find formats, so they can't be fixed up.

The two solutions seem to be​:

a) have pointers in parent pads to formats, or

Zefram did that in commit 421f30e, but it can cause a crash. A
format’s CvOUTSIDE must never be touched, because a format can be cloned
at any time, so its CvOUTSIDE must always be available for it to close
over. If CvOUTSIDE is weakened, the outer sub could be freed, causing
the format to point to its grandfather. Then cloning will read random
pad items from the wrong pad.

b) rejig newATTRSUB in such a way that it doesn't have to do the
abomination of copying the CV body.

Like copying it in perly.y​:subname instead?

An alternative fix would be to have the outer pad hold a weak reference
on the format.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jun 28, 2012

From @cpansprout

On Thu Jun 28 13​:17​:40 2012, sprout wrote​:

On Tue Feb 05 16​:33​:41 2008, davem wrote​:

The two solutions seem to be​:

a) have pointers in parent pads to formats, or

Zefram did that in commit 421f30e, but it can cause a crash. A
format’s CvOUTSIDE must never be touched, because a format can be cloned
at any time, so its CvOUTSIDE must always be available for it to close
over. If CvOUTSIDE is weakened, the outer sub could be freed, causing
the format to point to its grandfather. Then cloning will read random
pad items from the wrong pad.

I changed the direction of the weak reference, in commit e09ac07, since
that seemed the easiest fix.

b) rejig newATTRSUB in such a way that it doesn't have to do the
abomination of copying the CV body.

Like copying it in perly.y​:subname instead?

That is problematic, in that newATTRSUB is an API function, so we would
have to do it in both places, solving nothing.

If we could change that, with the new op slab allocator (not merged
yet), after errors we would end up with stubs floating around with slabs
attached to them--not something I find comforting.

--

Father Chrysostomos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant