diff --git a/src/runtime.c b/src/runtime.c index 1c7589a4a4a97fbfaa8317874fad40a8b2be732e..183d323e36c733889231007d4d7766b5c765a992 100644 --- a/src/runtime.c +++ b/src/runtime.c @@ -1506,19 +1506,6 @@ bind_runtime (PvRuntime *self, return FALSE; } - /* These can add data fds to @bwrap, so they must come last - after - * other functions stop using @bwrap as a basis for their own bwrap - * invocations with flatpak_bwrap_append_bwrap(). - * Otherwise, when flatpak_bwrap_append_bwrap() calls - * flatpak_bwrap_steal_fds(), it will make the original FlatpakBwrap - * unusable. */ - - flatpak_run_add_wayland_args (bwrap); - flatpak_run_add_x11_args (bwrap, TRUE); - flatpak_run_add_pulseaudio_args (bwrap); - flatpak_run_add_session_dbus_args (bwrap); - flatpak_run_add_system_dbus_args (bwrap); - if (self->mutable_sysroot == NULL) { /* self->overrides is in a temporary directory that will be diff --git a/src/wrap.c b/src/wrap.c index 3e9d2b069f25797b8653bea206e4f1255d4a625c..1812256b27426ba1ae36a3635b1ad99aff2def1a 100644 --- a/src/wrap.c +++ b/src/wrap.c @@ -35,6 +35,7 @@ #include "bwrap.h" #include "bwrap-lock.h" #include "flatpak-bwrap-private.h" +#include "flatpak-run-private.h" #include "flatpak-utils-base-private.h" #include "flatpak-utils-private.h" #include "runtime.h" @@ -1360,6 +1361,18 @@ main (int argc, NULL); } + /* We need to set up IPC rendezvous points relatively late, so that + * even if we are sharing /tmp via --filesystem=/tmp, we'll still + * mount our own /tmp/.X11-unix over the top of the OS's. */ + if (runtime != NULL) + { + flatpak_run_add_wayland_args (bwrap); + flatpak_run_add_x11_args (bwrap, TRUE); + flatpak_run_add_pulseaudio_args (bwrap); + flatpak_run_add_session_dbus_args (bwrap); + flatpak_run_add_system_dbus_args (bwrap); + } + flatpak_bwrap_add_args (bwrap, "--chdir", cwd_p, "--unsetenv", "PWD",