[elbe-devel] [PATCH] elbepack: use full path to chroot

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon May 13 14:58:30 CEST 2024


shellhelper.chroot() is executed as unittest.
It's not guaranteed that the user has 'chroot' on their PATH.
It's also more robust.

Reported-by: Eduard Krein <eduard.krein at linutronix.de>
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/shellhelper.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/elbepack/shellhelper.py b/elbepack/shellhelper.py
index f5f27a2b5a0c..f9b0f3ff235a 100644
--- a/elbepack/shellhelper.py
+++ b/elbepack/shellhelper.py
@@ -89,9 +89,9 @@ def chroot(directory, cmd, /, *, env_add=None, **kwargs):
         new_env.update(env_add)
 
     if _is_shell_cmd(cmd):
-        do(['chroot', directory, '/bin/sh', '-c', cmd], env_add=new_env, **kwargs)
+        do(['/usr/sbin/chroot', directory, '/bin/sh', '-c', cmd], env_add=new_env, **kwargs)
     else:
-        do(['chroot', directory] + cmd, env_add=new_env, **kwargs)
+        do(['/usr/sbin/chroot', directory] + cmd, env_add=new_env, **kwargs)
 
 
 def get_command_out(cmd, /, *, input=None, check=True, env_add=None, **kwargs):

---
base-commit: 0cef7de7c6083efc6b0b518f5fd5c2419c99cb87
change-id: 20240513-tests-chroot-02711346fdb1

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh at linutronix.de>



More information about the elbe-devel mailing list