From 1875801884411916ae39c882560b405db3b471a8 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Tue, 30 Jun 2015 08:47:07 -0700 Subject: [PATCH] run: Don't override xdg home variables on full home mount When the home directory is fully mounted in the app namespace, the XDG_*_HOME variables should be inherited from the environment. Otherwise, the variables will point to the unpopulated app data directory and applications querying the xdg user directories will not find the user's files or configuration. https://bugs.freedesktop.org/show_bug.cgi?id=91163 --- xdg-app-builtins-run.c | 2 +- xdg-app-run.c | 6 ++++++ xdg-app-run.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/xdg-app-builtins-run.c b/xdg-app-builtins-run.c index 3ffe388..f919bb9 100644 --- a/xdg-app-builtins-run.c +++ b/xdg-app-builtins-run.c @@ -381,7 +381,7 @@ xdg_app_builtin_run (int argc, char **argv, GCancellable *cancellable, GError ** envp = xdg_app_run_apply_env_vars (envp, app_context); - envp = xdg_app_run_apply_env_appid (envp, app_id_dir); + envp = xdg_app_run_apply_env_appid (envp, app_context, app_id_dir); if (execvpe (HELPER, (char **)argv_array->pdata, envp) == -1) { diff --git a/xdg-app-run.c b/xdg-app-run.c index 9919913..05d0c32 100644 --- a/xdg-app-run.c +++ b/xdg-app-run.c @@ -1361,12 +1361,18 @@ xdg_app_run_apply_env_default (char **envp) char ** xdg_app_run_apply_env_appid (char **envp, + XdgAppContext *context, GFile *app_dir) { g_autoptr(GFile) app_dir_data = NULL; g_autoptr(GFile) app_dir_config = NULL; g_autoptr(GFile) app_dir_cache = NULL; + /* Don't override variables for full home mount */ + if (g_hash_table_lookup (context->filesystems, "host") || + g_hash_table_lookup (context->filesystems, "home")) + return envp; + app_dir_data = g_file_get_child (app_dir, "data"); app_dir_config = g_file_get_child (app_dir, "config"); app_dir_cache = g_file_get_child (app_dir, "cache"); diff --git a/xdg-app-run.h b/xdg-app-run.h index d3498d1..5ecd8e8 100644 --- a/xdg-app-run.h +++ b/xdg-app-run.h @@ -57,6 +57,7 @@ void xdg_app_run_add_environment_args (GPtrArray *argv_array, char ** xdg_app_run_get_minimal_env (gboolean devel); char ** xdg_app_run_apply_env_default (char **envp); char ** xdg_app_run_apply_env_appid (char **envp, + XdgAppContext *context, GFile *app_dir); char ** xdg_app_run_apply_env_vars (char **envp, XdgAppContext *context); -- 1.9.3