Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 277537

Summary: $PATH — /sbin and /bin should be after /usr/*
Product: Portage Development Reporter: Michał Górny <mgorny>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: minor Keywords: InVCS
Priority: High    
Version: 2.2   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 210077, 288499    
Attachments: Patch to change $PATH set by ebuild.sh

Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2009-07-12 21:00:28 UTC
=sys-apps/portage-2.2_rc33 in ebuild.sh defines PATH likes this:

PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/bin:/usr/bin${ROOTPATH:+:}$ROOTPATH

Is there any real reason to keep /bin and /sbin before /usr ones? In my opinion, /usr/*bin should be placed before /*bin in $PATH.

Firstly, /*bin can contain some kind of stripped down versions of utilities which doesn't require /usr to be mounted. And then /usr/*bin would contain full-featured versions which should be used instead if /usr is available.

Secondly, this $PATH already contains /usr/local/*bin before /*bin and thus allows user to override root binaries with /usr/local ones. To keep the hierarchy clean we should allow /usr ones to override them too.

Moreover, this is the way /etc/profile by default (=baselayout-2.0.1) defines PATH. Thus, if there's no real reason to keep /*bin before /usr/*bin in portage-defined PATH, I think the PATH definition should be modified to:

PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin${ROOTPATH:+:}$ROOTPATH
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2009-07-12 21:43:48 UTC
Created attachment 197675 [details, diff]
Patch to change $PATH set by ebuild.sh
Comment 2 Zac Medico gentoo-dev 2009-08-06 19:27:24 UTC
Thanks, this is in svn r13935.

I copied the order from /etc/profile:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Comment 3 Zac Medico gentoo-dev 2009-08-10 00:25:23 UTC
This is fixed in 2.2_rc37.
Comment 4 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-08-24 11:49:23 UTC
Not released in 2.1.*.
Comment 5 Zac Medico gentoo-dev 2009-10-11 00:55:59 UTC
This is fixed in 2.1.7.