From e3820eeaf11f3b4614cbdfbc85675bc16a486e21 Mon Sep 17 00:00:00 2001 From: Pass Automated Testing Suite Date: Mon, 28 Sep 2020 17:49:55 +0200 Subject: [PATCH] path-lookup: Correct order of XDG_CONFIG_HOME and XDG_CONFIG_DIRS According to the XDG Base Directory Specification [1] XDG_CONFIG_HOME should take precedence over XDG_CONFIG_DIRS. Fixes: https://github.com/systemd/systemd/issues/16095 [1]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html --- man/systemd.unit.xml | 14 ++++++++++++-- src/basic/path-lookup.c | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml index 23c60d5c01..cc6606022b 100644 --- a/man/systemd.unit.xml +++ b/man/systemd.unit.xml @@ -60,12 +60,14 @@ $XDG_RUNTIME_DIR/systemd/user.control/* $XDG_RUNTIME_DIR/systemd/transient/* $XDG_RUNTIME_DIR/systemd/generator.early/* -~/.config/systemd/user/* +$XDG_CONFIG_HOME/systemd/user/* +$XDG_CONFIG_DIRS/systemd/user/* /etc/systemd/user/* $XDG_RUNTIME_DIR/systemd/user/* /run/systemd/user/* $XDG_RUNTIME_DIR/systemd/generator/* -~/.local/share/systemd/user/* +$XDG_DATA_HOME/systemd/user/* +$XDG_DATA_DIRS/systemd/user/* /usr/lib/systemd/user/* $XDG_RUNTIME_DIR/systemd/generator.late/* @@ -434,6 +436,10 @@ $XDG_CONFIG_HOME/systemd/user or $HOME/.config/systemd/user User configuration ($XDG_CONFIG_HOME is used if set, ~/.config otherwise) + + $XDG_CONFIG_DIRS/systemd/user or /etc/xdg/systemd/user + Additional configuration directories as specified by the XDG base directory specification ($XDG_CONFIG_DIRS is used if set, /etc/xdg otherwise) + /etc/systemd/user User units created by the administrator @@ -455,6 +461,10 @@ $XDG_DATA_HOME/systemd/user or $HOME/.local/share/systemd/user Units of packages that have been installed in the home directory ($XDG_DATA_HOME is used if set, ~/.local/share otherwise) + + $XDG_DATA_DIRS/systemd/user or /usr/local/share/systemd/user and /usr/share/systemd/user + Additional data directories as specified by the XDG base directory specification ($XDG_DATA_DIRS is used if set, /usr/local/share and /usr/share otherwise) + $dir/systemd/user for each $dir in $XDG_DATA_DIRS Additional locations for installed user units, one for each entry in $XDG_DATA_DIRS diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c index 3ea851c338..e763fd7993 100644 --- a/src/basic/path-lookup.c +++ b/src/basic/path-lookup.c @@ -181,10 +181,10 @@ static char** user_dirs( if (strv_extend(&res, generator_early) < 0) return NULL; - if (strv_extend_strv_concat(&res, config_dirs, "/systemd/user") < 0) + if (strv_extend(&res, persistent_config) < 0) return NULL; - if (strv_extend(&res, persistent_config) < 0) + if (strv_extend_strv_concat(&res, config_dirs, "/systemd/user") < 0) return NULL; /* global config has lower priority than the user config of the same type */