Skip to content
Snippets Groups Projects
Commit ee226382 authored by Simon McVittie's avatar Simon McVittie
Browse files

wrap: Rename a confusing FlatpakBwrap instance


It was previously named run_in_container, but it actually ran the
executable on a read-only copy of the host system, with the runtime
mounted on the "scratch" path (a tmpfs).

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent dd9c8f80
No related branches found
No related tags found
No related merge requests found
...@@ -823,7 +823,7 @@ run_bwrap (FlatpakBwrap *bwrap, ...@@ -823,7 +823,7 @@ run_bwrap (FlatpakBwrap *bwrap,
static gboolean static gboolean
try_bind_dri (FlatpakBwrap *bwrap, try_bind_dri (FlatpakBwrap *bwrap,
FlatpakBwrap *run_in_container, FlatpakBwrap *mount_runtime_on_scratch,
const char *overrides, const char *overrides,
const char *scratch, const char *scratch,
const char *tool_path, const char *tool_path,
...@@ -845,7 +845,7 @@ try_bind_dri (FlatpakBwrap *bwrap, ...@@ -845,7 +845,7 @@ try_bind_dri (FlatpakBwrap *bwrap,
libdir); libdir);
temp_bwrap = flatpak_bwrap_new (NULL); temp_bwrap = flatpak_bwrap_new (NULL);
flatpak_bwrap_append_bwrap (temp_bwrap, run_in_container); flatpak_bwrap_append_bwrap (temp_bwrap, mount_runtime_on_scratch);
flatpak_bwrap_add_args (temp_bwrap, flatpak_bwrap_add_args (temp_bwrap,
tool_path, tool_path,
"--container", scratch, "--container", scratch,
...@@ -889,7 +889,7 @@ try_bind_dri (FlatpakBwrap *bwrap, ...@@ -889,7 +889,7 @@ try_bind_dri (FlatpakBwrap *bwrap,
expr = g_strdup_printf ("path-match:%s", s2tc); expr = g_strdup_printf ("path-match:%s", s2tc);
temp_bwrap = flatpak_bwrap_new (NULL); temp_bwrap = flatpak_bwrap_new (NULL);
flatpak_bwrap_append_bwrap (temp_bwrap, run_in_container); flatpak_bwrap_append_bwrap (temp_bwrap, mount_runtime_on_scratch);
flatpak_bwrap_add_args (temp_bwrap, flatpak_bwrap_add_args (temp_bwrap,
tool_path, tool_path,
"--container", scratch, "--container", scratch,
...@@ -1178,7 +1178,7 @@ bind_runtime (FlatpakBwrap *bwrap, ...@@ -1178,7 +1178,7 @@ bind_runtime (FlatpakBwrap *bwrap,
if (ld_so != NULL) if (ld_so != NULL)
{ {
g_auto(GStrv) dirs = NULL; g_auto(GStrv) dirs = NULL;
g_autoptr(FlatpakBwrap) run_in_container = NULL; g_autoptr(FlatpakBwrap) mount_runtime_on_scratch = NULL;
g_autoptr(FlatpakBwrap) temp_bwrap = NULL; g_autoptr(FlatpakBwrap) temp_bwrap = NULL;
g_autofree gchar *libdir_in_container = g_build_filename ("/overrides", g_autofree gchar *libdir_in_container = g_build_filename ("/overrides",
"lib", "lib",
...@@ -1199,18 +1199,19 @@ bind_runtime (FlatpakBwrap *bwrap, ...@@ -1199,18 +1199,19 @@ bind_runtime (FlatpakBwrap *bwrap,
g_mkdir_with_parents (libdir_on_host, 0755); g_mkdir_with_parents (libdir_on_host, 0755);
g_mkdir_with_parents (this_dri_path_on_host, 0755); g_mkdir_with_parents (this_dri_path_on_host, 0755);
run_in_container = flatpak_bwrap_new (NULL); mount_runtime_on_scratch = flatpak_bwrap_new (NULL);
flatpak_bwrap_add_args (run_in_container, flatpak_bwrap_add_args (mount_runtime_on_scratch,
bwrap->argv->pdata[0], bwrap->argv->pdata[0],
"--ro-bind", "/", "/", "--ro-bind", "/", "/",
"--bind", overrides, overrides, "--bind", overrides, overrides,
"--tmpfs", scratch, "--tmpfs", scratch,
NULL); NULL);
if (!bind_usr (run_in_container, runtime, scratch, error)) if (!bind_usr (mount_runtime_on_scratch, runtime, scratch,
error))
return FALSE; return FALSE;
temp_bwrap = flatpak_bwrap_new (NULL); temp_bwrap = flatpak_bwrap_new (NULL);
flatpak_bwrap_append_bwrap (temp_bwrap, run_in_container); flatpak_bwrap_append_bwrap (temp_bwrap, mount_runtime_on_scratch);
flatpak_bwrap_add_args (temp_bwrap, flatpak_bwrap_add_args (temp_bwrap,
tool_path, tool_path,
"--container", scratch, "--container", scratch,
...@@ -1293,8 +1294,9 @@ bind_runtime (FlatpakBwrap *bwrap, ...@@ -1293,8 +1294,9 @@ bind_runtime (FlatpakBwrap *bwrap,
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++)
{ {
if (!try_bind_dri (bwrap, run_in_container, overrides, scratch, if (!try_bind_dri (bwrap, mount_runtime_on_scratch,
tool_path, dirs[j], libdir_on_host, error)) overrides, scratch, tool_path, dirs[j],
libdir_on_host, error))
return FALSE; return FALSE;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment