Always use the BusyBox implementation of 'su' in the chroots (#1085)

Fixes #1061.
This commit is contained in:
Oliver Smith 2018-01-06 14:01:46 +00:00 committed by GitHub
parent feb0f5d8e5
commit ea3fdfbab7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -22,12 +22,14 @@ import pmb.chroot.root
def user(args, cmd, suffix="native", working_dir="/", log=True,
auto_init=True, return_stdout=False, check=True):
"""
Run a command inside a chroot as "user"
Run a command inside a chroot as "user". We always use the
BusyBox implementation of 'su', because other implementations
may override the PATH environment variable (#1071).
:param log: When set to true, redirect all output to the logfile
:param auto_init: Automatically initialize the chroot
"""
cmd = ["su", "pmos", "-c", " ".join(cmd)]
cmd = ["busybox", "su", "pmos", "-c", " ".join(cmd)]
return pmb.chroot.root(args, cmd, suffix, working_dir, log,
auto_init, return_stdout, check)