develooper Front page | perl.perl5.porters | Postings from August 2013

[perl #119311] pads being reused in coderefs called from DESTROY

Thread Previous
From:
Jesse Luehrs
Date:
August 15, 2013 23:18
Subject:
[perl #119311] pads being reused in coderefs called from DESTROY
Message ID:
rt-3.6.HEAD-2552-1376608662-10.119311-75-0@perl.org
# New Ticket Created by  Jesse Luehrs 
# Please include the string:  [perl #119311]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=119311 >



This is a bug report for perl from doy@tozt.net,
generated with the help of perlbug 1.39 running under perl 5.18.0.


-----------------------------------------------------------------
[Please describe your issue here]

Given this script:

  sub foo {
      my ($block, $other) = @_;

      my $got;
      die "this is clearly a bug" if $got;

      $got = $other;

      $block->();
  }

  {
      package Foo;

      sub DESTROY {
          ::foo(sub { }, 1);
          return;
      }
  }

  # "exit(0) unless fork" also triggers the bug,
  # but a bare "fork" doesn't
  foo(sub { my $o = bless {}, 'Foo'; exit(0) if fork }, 1);

$got is keeping its previous value when foo() is called from the DESTROY
method. This has been broken since 5.8.0, a bisect points to 840a7b70 as
where the bug was introduced:

  commit 840a7b70755d06740715e982aa756f9d77203c4e
  Author: Ilya Zakharevich <ilya@math.berkeley.edu>
  Date:   Mon Dec 4 19:40:25 2000 -0500

      Re: [PATCH] The largest hoax of all times?
      Date: Tue, 5 Dec 2000 00:40:25 -0500
      Message-ID: <20001205004025.A4050@monk.mps.ohio-state.edu>

      Subject: Re: [PATCH] The largest hoax of all times?
      From: Ilya Zakharevich <ilya@math.ohio-state.edu>
      Date: Mon, 4 Dec 2000 23:55:53 -0500
      Message-ID: <20001204235553.A1140@monk.mps.ohio-state.edu>

      Subject: Re: [PATCH] The largest hoax of all times?
      From: Ilya Zakharevich <ilya@math.ohio-state.edu>
      Date: Tue, 5 Dec 2000 01:28:45 -0500
      Message-ID: <20001205012844.A4227@monk.mps.ohio-state.edu>

      Fix the unpredictable order of DESTROYs.

      p4raw-id: //depot/perl@7991

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl 5.18.0:

Configured by doy at Sat Aug  3 17:08:22 EDT 2013.

Summary of my perl5 (revision 5 version 18 subversion 0) configuration:
   
  Platform:
    osname=linux, osvers=3.9.3-x86_64-linode33, archname=x86_64-linux
    uname='linux tozt 3.9.3-x86_64-linode33 #1 smp mon may 20 10:22:57 edt 2013 x86_64 gnulinux '
    config_args='-de -Dprefix=/home/doy/perl5/perlbrew/perls/perl-5.18 -Aeval:scriptdir=/home/doy/perl5/perlbrew/perls/perl-5.18/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.8.1 20130725 (prerelease)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/../lib /usr/lib/../lib /lib /usr/lib /lib64 /usr/lib64
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.17.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.17'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'

Locally applied patches:
    

---
@INC for perl 5.18.0:
    /home/doy/perl5/perlbrew/perls/perl-5.18/lib/site_perl/5.18.0/x86_64-linux
    /home/doy/perl5/perlbrew/perls/perl-5.18/lib/site_perl/5.18.0
    /home/doy/perl5/perlbrew/perls/perl-5.18/lib/5.18.0/x86_64-linux
    /home/doy/perl5/perlbrew/perls/perl-5.18/lib/5.18.0
    .

---
Environment for perl 5.18.0:
    HOME=/home/doy
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/doy/perl5/perlbrew/bin:/home/doy/perl5/perlbrew/perls/perl-5.18/bin:/home/doy/.bin/nethack:/home/doy/.bin:/usr/local/sbin:/usr/local/bin:/usr/lib/ccache/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/vendor_perl:/usr/bin/core_perl
    PERLBREW_BASHRC_VERSION=0.64
    PERLBREW_HOME=/home/doy/.perlbrew
    PERLBREW_MANPATH=/home/doy/perl5/perlbrew/perls/perl-5.18/man
    PERLBREW_PATH=/home/doy/perl5/perlbrew/bin:/home/doy/perl5/perlbrew/perls/perl-5.18/bin
    PERLBREW_PERL=perl-5.18
    PERLBREW_ROOT=/home/doy/perl5/perlbrew
    PERLBREW_VERSION=0.64
    PERL_BADLANG (unset)
    PERL_CPANM_OPT=-q --mirror file:///home/doy/perl5/minicpan/ --mirror http://mirrors.kernel.org/cpan/ --mirror http://cpan.metacpan.org/ --prompt
    SHELL=/bin/zsh


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About