From 6f4ac41a7274ab4457c34d8a4ce0217fb72e973d Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Fri, 17 May 2019 12:02:18 +0100 Subject: [PATCH] wrap: Don't try to mount logical current working directory This works poorly if the path to the current working directory involves symlinks, for example /home/.steam/root, and they resolve differently in bwrap's temporary environment (where the old and new root directories are temporarily mounted on /oldroot and /newroot). Signed-off-by: Simon McVittie <smcv@collabora.com> --- src/wrap.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/wrap.c b/src/wrap.c index 604b412b6..5fd299c76 100644 --- a/src/wrap.c +++ b/src/wrap.c @@ -1914,28 +1914,7 @@ main (int argc, g_debug ("Making home directory available..."); - if (pv_is_same_file (home, cwd_l)) - { - g_debug ("Not making logical working directory \"%s\" available to " - "container because it is the home directory", - cwd_l); - } - else - { - flatpak_bwrap_add_args (bwrap, - "--bind", cwd_l, cwd_l, - NULL); - } - - flatpak_bwrap_add_args (bwrap, - "--chdir", cwd_l, - NULL); - - if (strcmp (cwd_p, cwd_l) == 0) - { - g_debug ("Physical and logical working directory coincide"); - } - else if (pv_is_same_file (home, cwd_p)) + if (pv_is_same_file (home, cwd_p)) { g_debug ("Not making physical working directory \"%s\" available to " "container because it is the home directory", @@ -1943,13 +1922,16 @@ main (int argc, } else { - /* Mount it in case the symlink resolution works out differently - * inside the container */ flatpak_bwrap_add_args (bwrap, "--bind", cwd_p, cwd_p, NULL); } + flatpak_bwrap_add_args (bwrap, + "--chdir", cwd_p, + "--unsetenv", "PWD", + NULL); + if (strstr (bwrap_help, "unshare-uts") != NULL) { g_debug ("Setting hostname..."); -- GitLab