Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 490014 - portage should not preserve EROOT in environment
Summary: portage should not preserve EROOT in environment
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Binary packages support (show other bugs)
Hardware: All Linux
: Highest critical
Assignee: Portage team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: 137867
  Show dependency tree
 
Reported: 2013-11-01 02:26 UTC by Benda Xu
Modified: 2022-12-10 00:18 UTC (History)
2 users (show)

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


Attachments
environment: Filter EROOT for all EAPIs (0001-environment-Filter-EROOT-for-all-EAPIs.patch,1.18 KB, patch)
2014-07-21 05:05 UTC, mike@marineau.org
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benda Xu gentoo-dev 2013-11-01 02:26:20 UTC
ROOT is overridable in portage, so should EROOT. 

It should be calculated from a refresh ROOT and preserved EPREFIX each time.

ref: https://bugs.gentoo.org/show_bug.cgi?id=473728#c12

Reproducible: Always
Comment 1 Fabian Groffen gentoo-dev 2013-11-01 11:09:49 UTC
IMO EROOT should NOT be overridable.  It should always be generated from ROOT and EPREFIX.
Comment 2 Benda Xu gentoo-dev 2013-11-02 02:28:45 UTC
(In reply to Fabian Groffen from comment #1)
> IMO EROOT should NOT be overridable.  It should always be generated from
> ROOT and EPREFIX.


Agreed.

side note: The only benefit to override EROOT is to be lazy, not liking to change two variables EPREFIX and ROOT. But that introduces inconsistency.
Comment 3 Benda Xu gentoo-dev 2013-11-22 09:17:35 UTC
Comments from the portage team?
Comment 4 mike@marineau.org 2014-07-21 04:52:54 UTC
The idiom of defining EROOT for old EAPIs has become very common, even eutils now defines:

> # Initialized prefix variables for EAPI<3.
> _eutils_eprefix_init() {
>     has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=} ${EROOT:=${ROOT}}
> }

So now a huge number of ebuilds are potentially impacted by this issue.
Comment 5 mike@marineau.org 2014-07-21 05:05:32 UTC
Created attachment 381192 [details, diff]
environment: Filter EROOT for all EAPIs

Here is a simple minded patch that filters EROOT. Unfortunately this breaks older copies of toolchain-binutils.eclass which did ${EROOT:=${ROOT}} at a global level. More recent versions do this in each phase function which is safe from filtering.
Comment 6 Fabio Erculiani (RETIRED) gentoo-dev 2014-08-04 15:24:51 UTC
This is something that should be fixed ASAP.
Comment 7 Fabio Erculiani (RETIRED) gentoo-dev 2014-08-04 15:27:01 UTC
Please consider to revert this:
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/eutils.eclass?r1=1.427&r2=1.428
Comment 8 Steve L 2014-08-12 12:53:12 UTC
Mike's patch looks fine to me, and would deal with the issue raised about the eutils code. (Obvious when you realise that was his motivation, but not so obvious when you don't know what the "revert" link is about.)

Though I'd initialise EROOT as grobian said, whenever a phase function is run, the filtering is still needed.

Additionally the eutils fallback should set
 : "${EROOT:=$ROOT$EPREFIX}"

..since it might as well be robust, if it's a fallback. Though if we set it unconditionally in ebuild.sh or phase-functions, it wouldn't be needed.

Minor tweak: the function can be defined on a per-EAPI basis, so it's a null event on later EAPIs.

In any event, I'd put mike's patch in now, since it's fine as bash, and needed w/e else you do. (The only thing I'd do differently is use: foo+=' single quotes' but that's trivial.)