[systemd-devel] ~/.local/bin , XDG, and environment variable overrides

Josh Triplett josh at joshtriplett.org
Tue Aug 29 19:49:03 UTC 2017


On Tue, Aug 29, 2017 at 06:43:58PM +0200, Lennart Poettering wrote:
> On Sa, 26.08.17 10:43, Josh Triplett (josh at joshtriplett.org) wrote:
> 
> > systemd's file-hierarchy manpage
> > <https://www.freedesktop.org/software/systemd/man/file-hierarchy.html>
> > documents ~/.local/bin as the place under $HOME to install executables
> > in $PATH, and quite a bit of software has adopted that. However, unlike
> > the directories specified in the XDG Base Directory specification, this
> > doesn't include an environment variable (like $XDG_DATA_HOME for
> > ~/.local/share) to override it. I've seen a proposal to use
> > $XDG_BIN_HOME for that. Might it make sense to include that, and start
> > getting software to adopt it?
> 
> Quite frankly, I am not sure that having env vars for all those dirs
> was a good idea in the first place, but sure, if you want to
> standardize that, please go ahead, you have my support. A patch to the
> XDG basedir spec should be very welcome.

Developers on some platforms (e.g. Haiku) wanted the ability to set
those paths. This came up in the context of installing Rust binaries,
which didn't want to hardcode ~/.local/bin , and using something like
$XDG_DATA_HOME/../bin seems quite wrong as well.

> But do not the architecture issues with such a dir, i.e. home
> directories might be shared between systems of different archs, and
> binary programs compiled for one arch and placed in these dirs are
> unlikely to work on the other. I figure this is the reason why this
> concept was never included in XDG basedir spec, but then again I think
> it's fine to still add it as long as the issue is highlighted.

The second version of the patch from Johannes Löthberg seems to address
that.

I also suspect that $XDG_BIN_HOME might actually help folks who want to
deal with that issue, by setting it to a multiarch-style directory that
includes the architecture triple.  (Though that would also imply
installing architecture-independent scripts multiple times; however, I
don't think it's worth trying to define an elaborate scheme to handle
that, not when things like /usr/local/bin and /usr/bin *don't*. We're
not trying to solve that new and rare problem here; we're trying to
document the defacto standard that already exists.)

> > Also, would it make sense to add ~/.local/bin to the XDG Base Directory
> > specification itself? I'd be happy to write up an addition to the spec
> > for that, and propose it on the appropriate list.
> 
> If you add the env var then it should be added to the xdg basedir spec.

See the patches from Johannes Löthberg on the XDG list.


More information about the systemd-devel mailing list