diff --git a/common/flatpak-run.c b/common/flatpak-run.c index 8aa6a863..b35d1df7 100644 --- a/common/flatpak-run.c +++ b/common/flatpak-run.c @@ -1717,6 +1717,14 @@ flatpak_run_add_extension_args (GPtrArray *argv_array, g_autofree char *ref = g_build_filename (full_directory, ".ref", NULL); g_autofree char *real_ref = g_build_filename (ext->files_path, ext->directory, ".ref", NULL); + if (ext->needs_tmpfs) + { + g_autofree char *parent = g_path_get_dirname (full_directory); + add_args (argv_array, + "--tmpfs", parent, + NULL); + } + add_args (argv_array, "--bind", ext->files_path, full_directory, NULL); diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c index d270e39a..1ccedcd7 100644 --- a/common/flatpak-utils.c +++ b/common/flatpak-utils.c @@ -2491,6 +2491,7 @@ flatpak_list_extensions (GKeyFile *metakey, g_autofree char *prefix = g_strconcat (extension, ".", NULL); g_auto(GStrv) refs = NULL; int j; + gboolean needs_tmpfs = TRUE; refs = flatpak_list_deployed_refs ("runtime", prefix, arch, branch, NULL, NULL); @@ -2503,6 +2504,8 @@ flatpak_list_extensions (GKeyFile *metakey, if (subdir_files) { ext = flatpak_extension_new (extension, refs[j], dir_ref, extended_dir, subdir_files); + ext->needs_tmpfs = needs_tmpfs; + needs_tmpfs = FALSE; /* Only first subdir needs a tmpfs */ res = g_list_prepend (res, ext); } } @@ -2510,7 +2513,7 @@ flatpak_list_extensions (GKeyFile *metakey, } } - return res; + return g_list_reverse (res); } diff --git a/common/flatpak-utils.h b/common/flatpak-utils.h index 27e7666a..7b124ebd 100644 --- a/common/flatpak-utils.h +++ b/common/flatpak-utils.h @@ -232,6 +232,7 @@ typedef struct char *ref; char *directory; char *files_path; + gboolean needs_tmpfs; } FlatpakExtension; void flatpak_extension_free (FlatpakExtension *extension); diff --git a/tests/test-extensions.sh b/tests/test-extensions.sh index 90b2a84d..16272854 100755 --- a/tests/test-extensions.sh +++ b/tests/test-extensions.sh @@ -53,9 +53,7 @@ add_extensions () { mkdir -p $DIR/files/foo/ext4 mkdir -p $DIR/files/foo/none mkdir -p $DIR/files/foo/dir - mkdir -p $DIR/files/foo/dir/foo mkdir -p $DIR/files/foo/dir2 - mkdir -p $DIR/files/foo/dir2/foo cat >> $DIR/metadata <