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

[perl #54044] perl -wle '%::=();//' crash

Thread Previous
From:
Father Chrysostomos via RT
Date:
October 27, 2013 23:23
Subject:
[perl #54044] perl -wle '%::=();//' crash
Message ID:
rt-4.0.18-13588-1382916184-1154.54044-15-0@perl.org
On Wed Apr 10 03:51:04 2013, Hugmeir wrote:
> On Wed, Apr 10, 2013 at 7:04 AM, Nicholas Clark <nick@ccl4.org> wrote:
> 
> > On Wed, Apr 10, 2013 at 06:48:23AM -0300, Brian Fraser wrote:
> > > Another objection, I don't think either of these should fail:
> > >
> > > $ ./perl -e '%:: = %::'
> > > Attempt to clear the %main:: symbol table at -e line 1.
> > >
> > > $ ./perl -e '%:: = map { $_ => $::{$_} } grep !/foo|bar/, keys %::;'
> > > Attempt to clear the %main:: symbol table at -e line 1.
> >
> > Given how hash list assignment is implemented, it's hard to see how to
> > permit those to keep working whilst also adding a way to prevent
> > clearing %::
> >
> > I can see that they are reduced test cases, but what's the real world
> > use case that they represent?
> >
> 
> Ah. Good question; None productive from me. I've only used them in joke
> modules and when trying to make Perl crash. So that's a strike against that
> objection.

Another objection:  It doesn’t fix the underlying issue, and it just adds a special case to prevent something that nobody does anyway (and the extra check will make every %hash=() marginally slower).

I think the real fix here is to make certain shortcut pointers (like PL_replgv) reference-counted as necessary.

I have already begun this.  I started for a different purpose; namely, to prevent gv_try_downgrade from trying to delete these (yes, it can do that!).

Once that’s done, I think this ticket can be closed.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=54044

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