Discussion:
~/.local/bin , XDG, and environment variable overrides
(too old to reply)
Josh Triplett
2017-08-26 17:43:20 UTC
Permalink
Raw Message
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?

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.

- Josh Triplett
Lennart Poettering
2017-08-29 16:43:58 UTC
Permalink
Raw Message
Post by Josh Triplett
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.

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.
Post by Josh Triplett
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.

Lennart
--
Lennart Poettering, Red Hat
Josh Triplett
2017-08-29 19:49:03 UTC
Permalink
Raw Message
Post by Lennart Poettering
Post by Josh Triplett
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.
Post by Lennart Poettering
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.)
Post by Lennart Poettering
Post by Josh Triplett
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.

Loading...