From 2a8a0ec69af533fb9f4b617833ab54c53b9ffa78 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 16 Dec 2018 22:36:33 -0500 Subject: [PATCH] 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 --- common/flatpak-run.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/flatpak-run.c b/common/flatpak-run.c index 09dd46b3..80aa4d59 100644 --- a/common/flatpak-run.c +++ b/common/flatpak-run.c @@ -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