Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 466844 - sys-apps/portage: SHELL variable reset on each phase
Summary: sys-apps/portage: SHELL variable reset on each phase
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 468524
  Show dependency tree
 
Reported: 2013-04-22 20:27 UTC by Michał Górny
Modified: 2013-05-03 21:12 UTC (History)
2 users (show)

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


Attachments
example test-case (test-1.ebuild,768 bytes, text/plain)
2013-04-22 20:30 UTC, Ian Stakenvicius (RETIRED)
Details

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 2013-04-22 20:27:06 UTC
Portage seems to reset SHELL for each ebuild phase to its default value, even if another value was exported in an earlier phase. While AFAICS PMS doesn't specify anything about SHELL, it requires PM to *preserve* all the exported variables in exported state.

Reproducible: Always

Steps to Reproduce:
src_configure() {
    export SHELL=/bin/foo
}

src_compile() {
    declare -p SHELL
}

Actual Results:  
declare -- SHELL="/bin/bash"


Expected Results:  
declare -x SHELL="/bin/foo"


As a note, the major issue hit here was that the ebuild in question did:

  export SHELL=/bin/bash

yet portage unexported the variable in next phases, making the build system fail.
Comment 1 Ian Stakenvicius (RETIRED) gentoo-dev 2013-04-22 20:30:02 UTC
Created attachment 346328 [details]
example test-case

The following ebuild can be used as a test case.  As-is, everything will work properly since its using "BUBBA" as the variable.

sed -i -e 's/BUBBA/SHELL/' test-1.ebuild , and try again ; then you will get failures unless you set USE="compile" to force the export within the src_compile() phase.
Comment 3 Zac Medico gentoo-dev 2013-05-03 21:12:19 UTC
This is fixed in 2.1.11.63 and 2.2.0_alpha174.