For some smart reason, Portage is reconstructing PATH using ROOTPATH and PREROOTPATH variables. It completely ignores PATH, however. This is surprising, at least, and inconsistent with how /etc/profile combines *both* variables. If you want to add a path both for users and for Portage, you end up duplicating it in PATH and ROOTPATH, and root gets it twice in PATH as a result.
> This is surprising, at least, and inconsistent with how /etc/profile combines *both* variables. How does /etc/profile "combine" both variables? All I see is this: > if [ "${EUID-}" = "0" ] || [ "${USER-}" = "root" ] ; then > PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}${ROOTPATH-}" > else > PATH="/usr/local/bin:/usr/bin:/bin${PATH:+:}${PATH-}" > fi
Hmm, curious. I wonder if it's my local modification or remnant of some past version. The former is possible, considering that otherwise root PATH would be pretty much useless...
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=69f2221413852630b2c231774e1f811f350fa3e6 commit 69f2221413852630b2c231774e1f811f350fa3e6 Author: Mike Gilbert <floppym@gentoo.org> AuthorDate: 2022-12-31 22:01:08 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2023-01-02 20:35:27 +0000 _doebuild_path: simplify logic used to set PATH Remove logic to incoporate PREROOTPATH and ROOTPATH. I'm not sure where PREROOTPATH was ever used, and ROOTPATH has been deprecated in baselayout for a while. Remove logic to add hard-coded directories like ${EPREFIX}/{,usr{,/local}/{sbin,bin}. Adding these paths is unnecessary if env.d or the calling environment have a valid PATH setting. Add logic to ignore PATH from the calling environment if PATH is set in env.d. This ensures that packages can update PATH by installing files in /etc/env.d and this will work without having to restart Portage with an updated environment. Bug: https://bugs.gentoo.org/607696 Bug: https://bugs.gentoo.org/693308 Bug: https://bugs.gentoo.org/888543 Signed-off-by: Mike Gilbert <floppym@gentoo.org> lib/portage/package/ebuild/doebuild.py | 44 +++++++++++----------------------- 1 file changed, 14 insertions(+), 30 deletions(-)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e342b1cae0ba19e35d27fe523ce0331e1412e295 commit e342b1cae0ba19e35d27fe523ce0331e1412e295 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-01-15 22:13:26 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-01-15 22:13:26 +0000 sys-apps/portage: add 3.0.44 Closes: https://bugs.gentoo.org/889328 Closes: https://bugs.gentoo.org/607696 Closes: https://bugs.gentoo.org/867031 Closes: https://bugs.gentoo.org/873202 Closes: https://bugs.gentoo.org/888543 Closes: https://bugs.gentoo.org/834038 Signed-off-by: Sam James <sam@gentoo.org> sys-apps/portage/Manifest | 1 + sys-apps/portage/portage-3.0.44.ebuild | 288 +++++++++++++++++++++++++++++++++ 2 files changed, 289 insertions(+)