From 596e50add6c7f3b1f8c0c5bbd9e92da6aed9a792 Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Fri, 13 Dec 2019 18:46:08 +0000 Subject: [PATCH] wrap: Mount pressure-vessel on /run/pressure-vessel if using runtime When we're using a non-trivial runtime, we need to make pressure-vessel-with-lock available to the container. Previously, if your pressure-vessel installation was visible via your home directory (if shared), via $(realpath ~/.steam/steam), or via the current working directory at the time of running pressure-vessel-wrap, then it would exist in the container at the same path as outside the container, so this would work. However, if you have installed it in an alternative Steam library such as /media/big/library, none of these mount points would make it visible and bwrap would fail to run it. Circumvent this by mounting the relocatable pressure-vessel prefix on /run/pressure-vessel, which lets us run it via that path. Bug: https://github.com/ValveSoftware/steam-runtime/issues/204 Signed-off-by: Simon McVittie <smcv@collabora.com> --- src/wrap.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/wrap.c b/src/wrap.c index 4cfcb4823..2393c2c42 100644 --- a/src/wrap.c +++ b/src/wrap.c @@ -1960,6 +1960,7 @@ main (int argc, g_autoptr(FlatpakBwrap) bwrap = NULL; g_autoptr(FlatpakBwrap) wrapped_command = NULL; g_autofree gchar *tmpdir = NULL; + g_autofree gchar *pressure_vessel_prefix = NULL; g_autofree gchar *scratch = NULL; g_autofree gchar *overrides = NULL; g_autofree gchar *overrides_bin = NULL; @@ -2208,6 +2209,8 @@ main (int argc, g_debug ("Found executable directory: %s", tools_dir); + pressure_vessel_prefix = g_path_get_dirname (tools_dir); + wrapped_command = flatpak_bwrap_new (NULL); switch (opt_terminal) @@ -2395,6 +2398,13 @@ main (int argc, if (!bind_runtime (bwrap, tools_dir, opt_runtime, overrides, scratch, error)) goto out; + + /* Make sure pressure-vessel itself is visible there. */ + flatpak_bwrap_add_args (bwrap, + "--ro-bind", + pressure_vessel_prefix, + "/run/pressure-vessel", + NULL); } else { @@ -2574,18 +2584,13 @@ main (int argc, * can't do that without breaking gameoverlayrender.so's assumptions. */ if (runtime_lock != NULL) { - g_autofree gchar *with_lock = NULL; g_autofree gchar *fd_str = NULL; int fd = pv_bwrap_lock_steal_fd (runtime_lock); - with_lock = g_build_filename (tools_dir, - "pressure-vessel-with-lock", - NULL); fd_str = g_strdup_printf ("%d", fd); - flatpak_bwrap_add_fd (bwrap, fd); flatpak_bwrap_add_args (bwrap, - with_lock, + "/run/pressure-vessel/bin/pressure-vessel-with-lock", "--subreaper", "--fd", fd_str, "--", -- GitLab