build: Fix issues when symlinks in / point into /var

Set up /var to $appdir/var binding after all the other filesystem
setup has happened. Before we did not do this, so a link from e.g.
/foo to /var/foo would be created in the appdir var rather than the tmpfs
var, which would fail with EEXIST the second time because that directory
is persisted.

In particular, this was problematic on endless os where /var/home is
a symlink.
tingping/wmclass
Alexander Larsson 2017-08-18 17:03:42 +02:00
parent 37fa3461c9
commit 1aadc3ee40
1 changed files with 5 additions and 5 deletions

View File

@ -338,11 +338,6 @@ flatpak_builtin_build (int argc, char **argv, GCancellable *cancellable, GError
"--setenv", "FLATPAK_DEST", dest,
NULL);
/* After setup_base to avoid conflicts with /var symlinks */
add_args (argv_array,
"--bind", flatpak_file_get_path_cached (var), "/var",
NULL);
app_context = flatpak_app_compute_permissions (metakey,
runtime_metakey,
error);
@ -374,6 +369,11 @@ flatpak_builtin_build (int argc, char **argv, GCancellable *cancellable, GError
app_context, NULL, NULL, cancellable, error))
return FALSE;
/* After setup_base to avoid conflicts with /var symlinks */
add_args (argv_array,
"--bind", flatpak_file_get_path_cached (var), "/var",
NULL);
for (i = 0; opt_bind_mounts != NULL && opt_bind_mounts[i] != NULL; i++)
{
char *split = strchr (opt_bind_mounts[i], '=');