FS#77447 - [filesystem][bash|zsh|...] Missing ~/.local/bin from $PATH as per systemd spec
Attached to Project:
Arch Linux
Opened by Martin Rys (C0rn3j) - Friday, 10 February 2023, 00:07 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:14 GMT
Opened by Martin Rys (C0rn3j) - Friday, 10 February 2023, 00:07 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:14 GMT
|
Details
Description:
systemd specification requires ~/.local/bin/ to be in $PATH, as per https://www.freedesktop.org/software/systemd/man/file-hierarchy.html - ~/.local/bin/ "Executables that shall appear in the user's $PATH search path." This can be verified on the running system with `systemd-path user-binaries` which will output the path. To fix this in Bash, one could use following code which is taken from Debian and should be put at the end of https://github.com/archlinux/svntogit-packages/blob/packages/bash/trunk/dot.bash_profile : ``` # set PATH so it includes user's private bin if it exists if [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH" fi ``` I am not sure how to fix this globally for all shells without edits for each, aside from perhaps a drop-in in /etc/profile.d? Repro of an issue - This path is used by pip which puts its executables into it when installed with --user: `pip install shell-gpt --user` `sgpt` will fail because it is in `~/.local/bin/sgpt` |
This task depends upon
Closed by Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:14 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p ackaging/packages/filesystem/issues/3
Saturday, 25 November 2023, 20:14 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p ackaging/packages/filesystem/issues/3
Arch doesn't add any user owned directory in $PATH by default and doing so may be questionable especially when you prepend those before binaries from /usr as in your example. Putting something that clashes with important system binary could wreak havoc.
Debian and Ubuntu set it - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839155
Fedora, RHEL and CentOS set it - https://bugzilla.redhat.com/show_bug.cgi?id=1583227
Arch is the outlier here.
As for your concern about clashing with system binaries, that's why other distributions add the user binaries path to the end of $PATH, so such clashes cannot happen in a way that the user binary is preferred.
Just download "bash" deb package and see /etc/skel/.profile file:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
It;s worth noting that the fact ubuntu/debian set this in /etc/skel/.profile not /etc/profile means it's effective only for newly created user accounts on system. If Arch is going to add this in PATH it should also be done only for new accounts not manipulate existing ones.