New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
protect some magic %main:: symbols from being deleted #12908
Comments
From @rurbanCreated by @rurbanThis is a bug report for perl from rurban@cpanel.net, ----------------------------------------------------------------- perl -e 'delete $::{ENV}; chdir' # by hugmeir Adding this to S_hv_delete_common() if ( hv == PL_defstash ) { and so on solves it, without taking into account that \010 needs to be if ( hv == PL_defstash ) { Probably other symbols need also to be protected, Perl Info
|
From @rurbanSee my github branch rurban/delete-protected-syms-rt117543 for the https://github.com/rurban/perl/tree/rurban/delete-protected-syms-rt117543 Ongoing research what other syms need to be protected like that. |
The RT System itself - Status changed from 'new' to 'open' |
From @HugmeirOn Tue, Apr 9, 2013 at 1:24 PM, rurban@cpanel.net <perlbug-followup@perl.org
I'm not sure if this is the right solution; You can probably still make it
$^R (PL_replgv) for regexen, *_ (PL_defgv) for everything (it won't crash, Here's the thing though. There's a handful of variables where this does not perl -e 'delete $::{INC}; require strict;' # All good, even though @INC and This is because S_init_main_stash in perl.c has lines like these: SvREFCNT_inc_simple_void(PL_incgv); /* Don't allow it to be freed */ Which will internally preserve *INC, even though it's not being exposed to Here's a proof of concept of the above: |
From @nwc10On Wed, Apr 10, 2013 at 07:29:05AM -0300, Brian Fraser wrote:
But it arguably contradicts the documentation further. Right now, require $ perl -le '@COPY = @INC; @INC = (); delete $::{INC}; eval q{@INC = @COPY}; eval q{print foreach @INC}; require strict' Now, to be clear I'm not saying that the above is anything other than a
This should be sufficient, without the reference count increase games, In that doing this, it becomes possible to "reattach" the shortcut pointers But I guess this comes down to a design decision - what are those pointers Nicholas Clark |
From @tonycozOn Wed Apr 10 04:29:03 2013, nicholas wrote:
I'd mostly prefer to protect symbols, but I wonder if that would We have three choices I can think of: 1) retain the current implementation - the user can crash perl from 2) protect any globals connected to PL_* from deletion 3) ensure PL_* are updated when their perl variables are updated. I can see 2) or 3) having a performance impact if they cover all the I don't really have an opinion either way. Tony (Looking at this ticket because it has patches.) [1] none of which I can think of right now |
From @davidnicolWe have three choices I can think of:
I'm a little bit stunned that nobody yet has suggested fixing the |
From @LeontOn Wed, Jul 17, 2013 at 6:55 PM, David Nicol <davidnicol@gmail.com> wrote:
I think Brian suggested just that when he talked about "safeguard each Leon |
From @bulk88I've attached what I think is a a pure perl example of this bug, run with 5.10.0. Correct me if it isn't an example. C:\Documents and Settings\Owner\Desktop>perl stashdelete.pl C:\Documents and Settings\Owner\Desktop>perl stashdelete.pl C:\Documents and Settings\Owner\Desktop> 1st run is with the "delete Now a "my $walker = B::Concise::compile('-src','-exec', *run{CODE});" C:\Documents and Settings\Owner\Desktop>perl stashdelete.pl C:\Documents and Settings\Owner\Desktop> -- |
From @bulk88 |
From @bulk88On Sat Dec 21 16:55:06 2013, bulk88 wrote:
Wrong file uploaded. Uping right file. -- |
From @bulk88sub dienow {
die "die now";
}
use Data::Dumper;
#comment delete out to make this pass
#delete $::{'@'};
eval {dienow()};
die '$@ is broken' if index($@,"die now") != 0;
die '$@ not equal to glob SCALAR ' if $@ ne ${ *{'main::@'}{SCALAR} }; |
@cpansproutbulk88 wrote:
I think delete $::{'@'} falls squarely under the 'don't do that' cat- I believe I have fixed all crashes of this sort. |
I have tested all of the reported cases and they do not fail on 5.30. I'm closing this case as resolved. |
Migrated from rt.perl.org#117543 (status was 'open')
Searchable as RT117543$
The text was updated successfully, but these errors were encountered: