[master][simplePATCH] Call os.chdir("/") after calling os.chroot

Will Woods wwoods at redhat.com
Tue Apr 9 14:13:03 UTC 2013


This is the Right Way To Chroot. ACK.

On Mon, 2013-04-08 at 19:01 +0200, Vratislav Podzimek wrote:
> This is what the 'chroot' utility does and there are at least some tools
> that fail to run in chroot without it.
> 
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
>  pyanaconda/iutil.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
> index fcce3af..8598e96 100644
> --- a/pyanaconda/iutil.py
> +++ b/pyanaconda/iutil.py
> @@ -65,6 +65,7 @@ def _run_program(argv, root='/', stdin=None, stdout=None, env_prune=None):
>      def chroot():
>          if root and root != '/':
>              os.chroot(root)
> +            os.chdir("/")
>  
>      with program_log_lock:
>          program_log.info("Running... %s" % " ".join(argv))
> @@ -161,6 +162,7 @@ def execReadlines(command, argv, stdin=None, root='/', env_prune=None):
>      def chroot():
>          if root and root != '/':
>              os.chroot(root)
> +            os.chdir("/")
>  
>      argv = [command] + argv
>      with program_log_lock:




More information about the anaconda-patches mailing list