RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1583227 - ~/.local/bin is not added at the top of the user PATH even if is documented by systemd and XDG spec
Summary: ~/.local/bin is not added at the top of the user PATH even if is documented b...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: bash
Version: 7.7-Alt
Hardware: All
OS: All
unspecified
medium
Target Milestone: rc
: ---
Assignee: Siteshwar Vashisht
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
: 1093432 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-28 13:53 UTC by Sorin Sbarnea
Modified: 2020-03-09 09:32 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-28 15:10:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Sorin Sbarnea 2018-05-28 13:53:18 UTC
Description of problem:

Apparently RHEL does not respect the systemd specification which documents clearly the ~/.local/bin it is part of PATH.

https://www.freedesktop.org/software/systemd/man/file-hierarchy.html

How reproducible:
Always

Steps to Reproduce:
1. set |grep PATH

Actual results:
PATH=/usr/lib64/ccache:/sbin:/bin:/usr/sbin:/usr/bin

Expected results:
PATH=~/.local/bin:/usr/lib64/ccache:/sbin:/bin:/usr/sbin:/usr/bin

Additional info:

Note that this feature is not specific to destop usage and respecting it essential for many tools to work correctly.

For example when using pip to install modules at user level the executables will be installed inside ~/.local/bin, and because RHEL does not add them to path scripts running them would get broken.

This PATH is supposed to be appended at the start of the PATH list, not at the end, allowing users to override default tool to be used with the ones installed by themselves. 

Example: user wanting to use newer version of virtualenv, tox, pip, which is not available/provided by the operating system.

Comment 2 Siteshwar Vashisht 2018-05-28 14:09:15 UTC
It should be set by ~/.bash_profile on rhel 7. This is the default bash_profile:

$ cat ~/.bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

Either you have modified ~/.bash_profile on your system or you are overriding PATH after ~/.bash_profile is sourced.

Comment 3 Sorin Sbarnea 2018-05-28 14:43:21 UTC
It was my mistake as I used su to change user and I forgot to use `-l` to specify the login. In that case the PATH is not updated and it does use the default, which does not include it.

One thing that I observed is that the user bin path is added to the end of the list and this could be problematic because if users installs his own tool, that tool will never be used as long there is one installed at system level.

I am not sure if the spec(s) do mention the precedence order of the PATHs as my impression is that user one should take precedence, allowing user-override.

Comment 5 Siteshwar Vashisht 2018-05-28 15:10:05 UTC
> One thing that I observed is that the user bin path is added to the end of the list and this could be problematic because if users installs his own tool, that tool will never be used as long there is one installed at system level.

It is already being discussed in fedora-devel[1].

[1] https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/OXXC5NOZP37W2F6GHV6P5E6K22QHOBNJ/

Comment 6 Sorin Sbarnea 2018-05-29 07:40:12 UTC
Thanks for posting the link to Fedora discussion. Apparently the discussion took place about 3 weeks ago and didn't get any clear outcomes. 

A small summary:
- Debian/Ubuntu now adds that to the top of the PATH, as expected.
- security concerns are irrelevant because any user can already alter PATH or create files on his own home directory.

Comment 7 Alexander Larsson 2020-03-09 09:32:11 UTC
*** Bug 1093432 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.