portal: Pass run-environ to the spawned flatpak process, not the sandbox

Instead of modifying the host-like run environment to clear the sandbox
environment, we'll use the new --clear-env flag which does the correct
thing.

Assisted-by: Claude:opus-4.6
Closes: #5271
This commit is contained in:
Sebastian Wick committed 2026-07-27 13:51:16 +00:00
1 parent 7322a05c7f
commit afbabdc32c
1 file changed
+3 -11
+3 -11
View File
@@ -917,17 +917,6 @@ handle_spawn (PortalFlatpak *object,
}
}
/* TODO: Ideally we should let `flatpak run` inherit the run environment
* of the instance, in case e.g. a LD_LIBRARY_PATH is needed to be able
* to run `flatpak run`, but tell it to start from a blank environment
* when running the Flatpak app; but this isn't currently possible, so
* for now we preserve existing behaviour. */
if (arg_flags & FLATPAK_SPAWN_FLAGS_CLEAR_ENV)
{
char *empty[] = { NULL };
env = g_strdupv (empty);
}
else
{
static const char * const mock_run_environ[] = { "FOO=bar", NULL };
@@ -965,6 +954,9 @@ handle_spawn (PortalFlatpak *object,
g_ptr_array_add (flatpak_argv, g_strdup ("run"));
if (arg_flags & FLATPAK_SPAWN_FLAGS_CLEAR_ENV)
g_ptr_array_add (flatpak_argv, g_strdup ("--clear-env"));
sandboxed = (arg_flags & FLATPAK_SPAWN_FLAGS_SANDBOX) != 0;
if (sandboxed)