develooper Front page | perl.perl5.porters | Postings from April 2003

Re: [perl #21914] 3-arg open + local $fh + strict coredump

Thread Previous | Thread Next
Rafael Garcia-Suarez
April 10, 2003 09:58
Re: [perl #21914] 3-arg open + local $fh + strict coredump
Message ID:
Jarkko Hietaniemi wrote:
> I may be compleletly wrong on this but maybe the PL_nullstash
> was handling the "homeless" variables created by the "package;"
> feature which is what the #17942 was removing.

Yes :
(And applying #17942 in reverse solves the bug.)

$ perl5.8.0 -le 'package;@{"homeless"};print for keys %{"<none>::"}'

But it also holds the illegal variables :

$ perl5.8.0 -le 'use strict"vars";eval q{$foo};print for keys %{"<none>::"}'

Now (in bleadperl) the illegal variables are simply thrown away.
Which leads to this segfault case.

> But your patch looks good enough for now.

(Paranoid statement follows) : I don't know, perhaps there are other
uncovered bugs caused by this change.

And as says Adi :
> > I don't think that gv_fetchpv returning NULL when its 'add' argument 
> > is non-zero is exactly right - and I failed to see what was so
> > wrong with PL_nullstash.

So another fix is to have gv_fetchpv return a dummy stash instead of
null when it has an "add" argument (implemented by the undertested patch
below). This is equivalent as restoring PL_nullstash for that purpose.
(Except that this time I'd name it <buffy>::, because, you know, that's
sorta a hellmouth-stash. Bad things go there and don't go out.)

Thoughts ?

Index: gv.c
--- gv.c	(revision 1094)
+++ gv.c	(working copy)
@@ -764,8 +764,10 @@ Perl_gv_fetchpv(pTHX_ const char *nambeg
 		  : sv_type == SVt_PVAV ? "@"
 		  : sv_type == SVt_PVHV ? "%"
 		  : ""), name));
+	    stash = GvHV(gv_fetchpv("<buffy>::", GV_ADDMULTI, SVt_PVHV));
-	return Nullgv;
+	else
+	    return Nullgv;
     if (!SvREFCNT(stash))	/* symbol table under destruction */
Usable is not *NIX

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