Pass host xdg dirs into the sandbox

There are some use cases where apps might legitimately need
to know the host values of xdg variables. Since we use them
for our own purposes, we can't just propagate them as-is.
Instead, set HOST_XDG_{DATA,CONFIG,CACHE}_HOME if the corresponding
xdg variables are set on the host.

Closes: #2424

Closes: #2440
Approved by: alexlarsson
This commit is contained in:
Matthias Clasen
2018-12-16 22:36:33 -05:00
committed by Atomic Bot
parent d13211f5e6
commit 2a8a0ec69a

View File

@@ -1318,6 +1318,13 @@ flatpak_run_apply_env_appid (FlatpakBwrap *bwrap,
flatpak_bwrap_set_env (bwrap, "XDG_DATA_HOME", flatpak_file_get_path_cached (app_dir_data), TRUE);
flatpak_bwrap_set_env (bwrap, "XDG_CONFIG_HOME", flatpak_file_get_path_cached (app_dir_config), TRUE);
flatpak_bwrap_set_env (bwrap, "XDG_CACHE_HOME", flatpak_file_get_path_cached (app_dir_cache), TRUE);
if (g_getenv ("XDG_DATA_HOME"))
flatpak_bwrap_set_env (bwrap, "HOST_XDG_DATA_HOME", g_getenv ("XDG_DATA_HOME"), TRUE);
if (g_getenv ("XDG_CONFIG_HOME"))
flatpak_bwrap_set_env (bwrap, "HOST_XDG_CONFIG_HOME", g_getenv ("XDG_CONFIG_HOME"), TRUE);
if (g_getenv ("XDG_CACHE_HOME"))
flatpak_bwrap_set_env (bwrap, "HOST_XDG_CACHE_HOME", g_getenv ("XDG_CACHE_HOME"), TRUE);
}
void