[pypy-issue] [issue1195] sandbox interactor not trivially usable as a drop-in replacement for python

chrysn tracker at bugs.pypy.org
Thu Jun 28 21:07:32 CEST 2012

New submission from chrysn <chrysn at fsfe.org>:

while exploring ways to use sandboxed pypy for ad-hoc extensions to wiki software (like 
executable wiki pages), i found some issues that could easily make pypy-sandbox more usable:

* return values are not propagated. replacing the `sandproc.interact()` line with 
`sys.exit(sandproc.interact())` would help there. conversely, the "[Subprocess exit code: %d]" & 
co error prints in SimpleIOSandboxProc.interact should only be shown if verbosity is turned on.

* the information whether stdin is a tty or not is discarded. as a result, `echo "print 40+2" | 
pypy-sandbox` does print 42, but also prints welcome messages and prompts. attempts to 
circumvent the problem like `... | pypy-sandbox /dev/stdin` failed as expected.

* pypy-sandbox runs always show the following lines in their stderr:

Not Implemented: SomeString(no_nul=True)
'import site' failed

* in my opinion, an --export=/some/path option would be more useful than the --tmp= option; it 
could, for every occurrence, export a path to itself (ie /some/path would be accessible as 
/some/path inside the sandbox too), and optionally include it in the PYTHONPATH by default (eg -
-export-in-path=/some/other/dir). by the same mechanism, the first argument to pypy-sandbox (the 
script to run) could be implicitly exported, enabling `pypy-sandbox ./some_script.py`

all behaviors were observed on pypy 1.9 as packaged in debian as 1.9+dfsg-1.

messages: 4512
nosy: chrysn, pypy-issue
priority: wish
status: unread
title: sandbox interactor not trivially usable as a drop-in replacement for python

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list