Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 607696 - sys-apps/portage: does not respect PATH from env.d (uses ROOTPATH only)
Summary: sys-apps/portage: does not respect PATH from env.d (uses ROOTPATH only)
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on: 889328
Blocks:
  Show dependency tree
 
Reported: 2017-01-30 08:56 UTC by Michał Górny
Modified: 2023-03-20 04:27 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-01-30 08:56:27 UTC
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.
Comment 1 Mike Gilbert gentoo-dev 2017-01-30 14:36:17 UTC
> 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
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-01-30 16:03:41 UTC
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...
Comment 3 Larry the Git Cow gentoo-dev 2023-01-02 20:45:58 UTC
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(-)
Comment 4 Larry the Git Cow gentoo-dev 2023-01-15 22:14:00 UTC
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(+)