[systemd-devel] Help on Automatic Symlink XDG_DATA_HOME

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sat Nov 2 06:43:08 PDT 2013


On Sat, Nov 02, 2013 at 01:43:51AM +0200, Mantas Mikulėnas wrote:
> On Sat, Nov 2, 2013 at 1:37 AM, Zbigniew Jędrzejewski-Szmek
> <zbyszek at in.waw.pl> wrote:
> > On Fri, Nov 01, 2013 at 11:02:30PM +0000, systemdkiosk at yopmail.com wrote:
> >> Might some expert address:
> >>
> >> https://bbs.archlinux.org/viewtopic.php?id=172220
> >>
> >> It seems systemd pushes hard-wired paths irrespective of XDG vars, a
> >> possible bug.
> >>
> >> On this box XDG_DATA_HOME and XDG_CACHE_HOME point outside $HOME, while
> >> XDG_CONFIG_HOME is the default ~/.config folder. XDG_DATA_DIRS is the
> >> default,
> >> /usr/local/share/:/usr/share/
> > Looking at the code, it seems that systemd will create the symlink
> > in ~/.local/share/systemd/user only if $XDG_DATA_HOME is not set.
> > Are you sure that systemd is actually running with this variable set?
> >
> >> No file ~/.config/systemd/user exists. Still systemd insists on its
> >> symlink in .local and will manufacture all the parent dirs just to
> >> create that broken symlink to a nonexistent file.
> > Hm, this might be an actual bug. I guess that systemd should not create
> > the link if the destination doesn't exist.
> >
> >> I'd like reliable ways to tell systemd how to use, or not use $HOME. If
> >> another way than XDG vars wil serve pray tell.
> > This should work.
> 
> I'm curious why the symlink is created at all... or in other words,
> why systemd looks in /usr/share and ~/.local/share for user units in
> the first place? It is neither documented in systemd.unit(5), nor
> consistent with the system unit paths, nor makes much sense since
> AFAIK the units are "configuration", not data?
It is documented in the source in comments. Basically, those dirs
are a fallback for the case where $XDG_CONFIG_HOME is not set, but
to avoid having two dirs with esentially the same semantics, they
are symlinked to be one and the same. Maybe it's just too much magic.

Zbyszek


More information about the systemd-devel mailing list