[systemd-devel] [PATCH 2/2] path-lookup: don't hardcode .config
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Sat Apr 12 10:30:26 PDT 2014
On Sat, Apr 12, 2014 at 08:37:39AM +0300, Tanu Kaskinen wrote:
> If XDG_CONFIG_HOME is set, then we should respect that.
> ---
> src/shared/path-lookup.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
> index 63af43c..a885b66 100644
> --- a/src/shared/path-lookup.c
> +++ b/src/shared/path-lookup.c
> @@ -135,8 +135,12 @@ static char** user_dirs(
> * then filter out this link, if it is actually is
> * one. */
>
> + /* If home is non-NULL, then config_home must be
> + * non-NULL as well. */
> + assert(config_home);
> +
> mkdir_parents_label(data_home, 0777);
> - (void) symlink("../../../.config/systemd/user", data_home);
> + (void) symlink(config_home, data_home);
> }
The change is good, as it fixes a misbehaviour for people who have
non-default settings for XDG_CONFIG_HOME and XDG_CONFIG_DATA. But we
really want to keep the path relative, since home directories tend to
be mounted at different points in the hierarchy (e.g. on the host, and
in the containers), so it would be annoying for the general case to have
an absolute path here. Can you add a function which makes the symlink relative
by stripping the common prefix and adding '../' as necessary and use it
here?
Zbyszek
More information about the systemd-devel
mailing list