[Python-bugs-list] [ python-Bugs-434743 ] rexec bug / doc bug?
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 21 Jun 2001 02:05:50 -0700
Bugs item #434743, was updated on 2001-06-20 03:25
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=434743&group_id=5470
Category: Documentation
Group: Not a Bug
Status: Open
Resolution: None
Priority: 5
Submitted By: Harri Pasanen (harripasanen)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: rexec bug / doc bug?
Initial Comment:
I would expect to get an ImportError from the
estr_env.r_exec("import sys; sys.exit(1)") line below.
Even if 'sys' is not in the ok_builtin_modules, it
seems to import just fine.
import rexec
class MySandBox(rexec.RExec):
def __init__(self, hooks, verbose):
rexec.RExec.__init__(self, hooks, verbose)
print self.ok_builtin_modules
restr_env = MySandBox(None, 1)
restr_env.r_exec("print 'does something'")
restr_env.r_exec("import sys; sys.exit(1)")
print "Never comes here"
Is the documentation incomplete or is this a bug?
-Harri
----------------------------------------------------------------------
>Comment By: Harri Pasanen (harripasanen)
Date: 2001-06-21 02:05
Message:
Logged In: YES
user_id=77088
Ok, what threw me of is that SystemExit is not putting up a
traceback on screen. Why is that? So it looked like
sys.exit() was called and working instead.
If I do something like:
restr_env.r_exec("a = 1/0")
then I do get a traceback on screen.
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2001-06-20 11:13
Message:
Logged In: YES
user_id=6380
Code executing in a rexec sandbox has its own copy of 'sys',
complete with a fake sys.path, sys.modules, sys.exit etc.
sys.exit() happens to raise the SystemExit exception; the
caller should catch that if the sandboxed code is not
supposed to cause the program to exit (the caller should be
catching all exceptions anyway, right).
Assigned to Fred for a small doc update perhaps.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=434743&group_id=5470