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

Eduard Krein eduard.krein at linutronix.de
Mon May 13 16:28:29 CEST 2024


Am Montag, dem 13.05.2024 um 14:58 +0200 schrieb Thomas Weißschuh:
> 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>
Reviewed-by: Eduard Krein <eduard.krein 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,

-- 
Eduard Krein
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 19; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/legal/data-protection.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen |
Registergericht (Registration Court): Amtsgericht Freiburg i.Br.,
HRB700 806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas
Gleixner, Tiffany Silva, Sean Fennelly, Jeffrey Schneiderman






More information about the elbe-devel mailing list