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

Re: [perl #117393] undef %::; causes several crashes

Thread Previous | Thread Next
Brian Fraser
March 28, 2013 22:00
Re: [perl #117393] undef %::; causes several crashes
Message ID:
On Thu, Mar 28, 2013 at 5:34 PM, Brian Fraser <> wrote:
> # New Ticket Created by  Brian Fraser
> # Please include the string:  [perl #117393]
> # in the subject line of all future correspondence about this issue.
> # <URL: >
> This is a bug report for perl from,
> generated with the help of perlbug 1.39 running under perl 5.16.2.
> -----------------------------------------------------------------
> [Please describe your issue here]
> perl -e 'undef %::; chdir'
> undef %::; makes several functions[*] that use global variables
> crash, e.g. eval due to PL_hintgv and chdir because of PL_envgv.
> I haven't bisected it, but it starts crashing somewhere between
> 5.10.0 and 5.10.1.
> This can be solved in a case by case basis by checking that
> the variables are isGV() before using them, and recreating them
> otherwise, but that is less than ideal.
> * both evals, chdir, require, sort, .., stat, glob, print/say, warn,
> plus a bunch of functions in sv.c. And there's several I missed.

Pardons for the barrage of mails. Here's a related case, and how I
found all of this.
This crashes:
    perl -e 'delete $::{ENV}; chdir();'

But this does not:
    perl -e 'BEGIN { delete $::{ENV} }; chdir();'

This is because there's a call to gv_fetchpvs in toke.c that adds the
ENV gv if it doesn't exist:
	case KEY_chdir:
	    /* may use HOME */
	    (void)gv_fetchpvs("ENV", GV_ADD|GV_NOTQUAL, SVt_PVHV);

That call has been there, some modifications in-between
notwithstanding, since 1993. I think that we should move it into
pp_chdir, or remove it entirely if the main issue in this ticket gets

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About