A bug introduced in #8217 (the undefined variable in the
authorJarkko Hietaniemi <jhi@iki.fi>
Tue, 23 Jan 2001 14:22:32 +0000 (14:22 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Tue, 23 Jan 2001 14:22:32 +0000 (14:22 +0000)
commit8c7314f9ab22287a19960f7531f5ca7120cc6843
treeb6374fcc5836cda07699bf422e73044bcbc24d88
parenteba8ff18d7b4f163fccc1997c51233b02fd29e80
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
ext/Opcode/Opcode.xs
ext/Opcode/Safe.pm