diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-01-23 14:22:32 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-01-23 14:22:32 +0000 |
commit | 8c7314f9ab22287a19960f7531f5ca7120cc6843 (patch) | |
tree | b6374fcc5836cda07699bf422e73044bcbc24d88 /ext/Opcode/Safe.pm | |
parent | eba8ff18d7b4f163fccc1997c51233b02fd29e80 (diff) | |
download | perl-8c7314f9ab22287a19960f7531f5ca7120cc6843.tar.gz |
A bug introduced in #8217 (the undefined variable in the
lib/safe1_t #3) fixed, by Charles Lane:
The earlier patch made it so that stuff running in Safe
compartments could do a "caller" and see "main". That
little change in name is done right before the code in
the compartment is run, and apparantly the parser
was picking up the stash name before it got changed.
(why it was threaded vs. unthreaded Perl that was sensitive to this
I still don't know...and it probably doesn't matter).
I tryed removing the stash name-change and saw that threaded Perl
did indeed pass the lib/safe1.t tests.
So here's a patch; a routine (_safe_pkg_prep) is added to Opcode to
do the name change (and to connect _ in the compartment to the global
_) which is removed from _safe_call_sv. Then Safe.pm is modified
to call _safe_pkg_prep when creating a new compartment.
Passes all tests with threaded perl on linux; passes all tests
with unthreaded perl on VMS.
At some point I'll probably want to revisit Safe and Opcode to
provide more sensible handling of global variables...and to get
formats working in Safe compartments, which they don't do currently.
p4raw-id: //depot/perl@8524
Diffstat (limited to 'ext/Opcode/Safe.pm')
-rw-r--r-- | ext/Opcode/Safe.pm | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/Opcode/Safe.pm b/ext/Opcode/Safe.pm index 7e1d6a34a7..a803b5f12d 100644 --- a/ext/Opcode/Safe.pm +++ b/ext/Opcode/Safe.pm @@ -47,6 +47,7 @@ sub new { # the whole glob *_ rather than $_ and @_ separately, otherwise # @_ in non default packages within the compartment don't work. $obj->share_from('main', $default_share); + Opcode::_safe_pkg_prep($obj->{Root}); return $obj; } |