User PATH Prioritization
Changing user PATH ~/.local/bin and ~/bin to be moved to the top of the PATH list instead of the end. This will bring Fedora in sync with other distributions which already fixed this issues (Debian/Ubuntu) and will make it easier for users to install and use their own command line tools, also fixing multiple bugs where user installed tools cannot be accessed because the system installed ones took precedence.
- Name: Sorin Sbarnea, Till Maas, Miro Hrončok
- Email: firstname.lastname@example.org, email@example.com, firstname.lastname@example.org
- Release notes owner:
- Targeted release: Fedora 29
- Last updated: 2018-06-26
- Tracker bug: #1595098
- Release Notes tracking: #186
Currently if user is installing their own tools with installers like (pip), they will be installed inside ~/.local/bin or ~/bin but if the same CLI tools are installed at system level the user would not be able to use his own tools because the system one would be picked instead. This happens because .bashrc file adds user PATH to the end instead of the top of PATH list variable.
Same problem was happening with other distributions but they fixed it (Debian bug #83915)
Example: "pip install --user virtualenv" would install virtualenv at user level, adding ~/.local/bin/virtualenv executable. Still, if virtualenv happens to be installed at system level, this would currently be used instead of user installed one. On the other hand, python itself already knows to prefer user installed modules which means that "python -m virtualenv" will call user installed module instead of the system one.
This may result in undefined behavior, where user installs foo, than run foo, but /usr/bin/foo is run and that import from Python modules in home. Those modules might have different API.
If we change the order and to assure the user folders do take precedence, we would assure that python modules and shell scripts would use the same modules, avoiding weird bugs where what you call is not what you installed.
The issue is not unique to pip installed and applies to any tools that are installed in de facto default XDG folder locations.
There should be no security concerns due to this change because any user is already able to add executables and to alter their own PATH, which means that if someone wants to trick a user to use another executable, they are already able to do that. This has already been proved several times in the initial discussions about this change.
After the change:
Note that this change will only affect new user accounts, we cannot change PATH for already existing accounts without crazy and undesired hacks.
Benefit to Fedora
This change makes it possible for users to install and use tools at user level, without requiring them to hack their user PATH in order to be able to use them.
This bring Fedora in sync with other major Linux distributions which adopted the same path, prioritisation.
- Proposal owners: change
/etc/skel/.bash_profileto have local folders before the system ones in default PATH
- Other developers: N/A (not a System Wide Change)
- Release engineering: #7554 (a check of an impact with Release Engineering is needed)
- List of deliverables: N/A (not a System Wide Change)
- Policies and guidelines: N/A (not a System Wide Change)
- Trademark approval: N/A (not needed for this Change)
N/A (not a System Wide Change)
How To Test
- pip install --upgrade --user virtualenv
- check that which virtualenv returns ~/.local/bin/virtualenv instead of another value like /usr/bin/virtualenv
There are no risk on breaking current deployments because this change would affect only newly created user accounts and nothing from default system installation would be installing tools at user level.
This would bring a huge benefits for Python package creators which avoided promoting user of pip install --user <packagename> for the sole reason that the executable may not be picked. Almost all python tools that are installing CLI utilities do have at least one bug raised by a user that reported that the wrong tool version was used instead.
- Contingency mechanism: (What to do? Who will do it?) proposal owners revert the chnage
- Contingency deadline: beta freeze
- Blocks release? no
- Blocks product? no
Fedora now prioritizes commands from
$HOME/bin over system-wide paths to allow to easily mask system binaries with newer versions. For example
pip install --user virtualenv will now work even when virtualenv from the package repositories is installed. The new behavior is only available for newly created user accounts.
- Release Notes tracking: #186