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

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

Thread Previous | Thread Next
From:
Brian Fraser
Date:
March 28, 2013 22:00
Subject:
Re: [perl #117393] undef %::; causes several crashes
Message ID:
CA+nL+nYS9s6SdWUxcVRyf=ZXevunRf2i4zxKNxUTY1TAS2rS8A@mail.gmail.com
On Thu, Mar 28, 2013 at 5:34 PM, Brian Fraser <perlbug-followup@perl.org> 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: https://rt.perl.org:443/rt3/Ticket/Display.html?id=117393 >
>
>
> This is a bug report for perl from fraserb@gmail.com,
> 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);
	    UNI(OP_CHDIR);

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
resolved.

Thread Previous | Thread Next


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