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
IMO EROOT should NOT be overridable. It should always be generated from ROOT and EPREFIX.
(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.
Comments from the portage team?
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.
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.
This is something that should be fixed ASAP.
Please consider to revert this: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/eutils.eclass?r1=1.427&r2=1.428
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.)