CodethinkLabs / sandboxlib

Sandboxing library
8 stars 4 forks source link

strange error calling sandboxlib on Fedora 22 on Scaleways ARM server... #11

Open devcurmudgeon opened 9 years ago

devcurmudgeon commented 9 years ago

Traceback (most recent call last): File "../ybd/ybd.py", line 41, in sandbox.executor = sandboxlib.executor_for_platform() File "/usr/lib/python2.7/site-packages/sandboxlib/init.py", line 175, in executor_for_platform program = sandboxlib.linux_user_chroot.linux_user_chroot_program() File "/usr/lib/python2.7/site-packages/sandboxlib/linux_user_chroot.py", line 276, in linux_user_chroot_program return sandboxlib.utils.find_program('linux-user-chroot') File "/usr/lib/python2.7/site-packages/sandboxlib/utils.py", line 43, in find_program program_path = subprocess.check_output(argv).strip() File "/usr/lib/python2.7/subprocess.py", line 566, in check_output process = Popen(stdout=PIPE, _popenargs, *_kwargs) File "/usr/lib/python2.7/subprocess.py", line 710, in init errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

basically 'which' doesn't exist on this system...

richardmaw-codethink commented 9 years ago

On Mon, Aug 31, 2015 at 02:28:11AM -0700, Paul Sherwood wrote:

Traceback (most recent call last): File "../ybd/ybd.py", line 41, in sandbox.executor = sandboxlib.executor_for_platform() File "/usr/lib/python2.7/site-packages/sandboxlib/init.py", line 175, in executor_for_platform program = sandboxlib.linux_user_chroot.linux_user_chroot_program() File "/usr/lib/python2.7/site-packages/sandboxlib/linux_user_chroot.py", line 276, in linux_user_chroot_program return sandboxlib.utils.find_program('linux-user-chroot') File "/usr/lib/python2.7/site-packages/sandboxlib/utils.py", line 43, in find_program program_path = subprocess.check_output(argv).strip() File "/usr/lib/python2.7/subprocess.py", line 566, in check_output process = Popen(stdout=PIPE, _popenargs, *_kwargs) File "/usr/lib/python2.7/subprocess.py", line 710, in init errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

That's odd. It looks like the which program isn't installed, and sandboxlib only handles the target binary not existing, rather than the which program not.

I'd suggest either installing which (which normally comes from busybox or debianutils in my experience), or changing the code to fall back to something like:

for execdir in search_path.split(':'):
    execpath = os.path.join(execdir, program_name)
    if os.path.exists(execpath):
        program_path = execpath
        break
else:
    program_path = None

If you want to make it more platform independent you'll need platform dependent search_path parsing, but the existing implementation is already platform dependent when falling back to which.