Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 230365 - EXTRA_ECONF should be treated as an array
Summary: EXTRA_ECONF should be treated as an array
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-01 15:50 UTC by Paul Davis
Modified: 2013-12-25 08:31 UTC (History)
0 users

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


Attachments
Sample toolchain.eclass eval fix (toolchain.eclass.patch,1.03 KB, text/plain)
2008-07-01 15:51 UTC, Paul Davis
Details
Test program (tst,390 bytes, text/plain)
2008-07-01 21:04 UTC, Paul Davis
Details
Bogus configure for test to call (configure,74 bytes, text/plain)
2008-07-01 21:05 UTC, Paul Davis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Davis 2008-07-01 15:50:09 UTC
The command line of external executables will not always parse correctly arguments containing spaces even if quoted. A simple example is when compiling gcc and a EXTRA_ECONF="--enable-cxx-flags='-O2 -g'" is passed, the configure will currently mistakenly parse this as "--enable-cxx-flags='-O2" and "-g'", resulting in a unexpected EOF error.

The solution is simply to prepend an 'eval' statement before calling external executables.

A sample of this is attached for the toolchain.eclass.
Comment 1 Paul Davis 2008-07-01 15:51:04 UTC
Created attachment 159127 [details]
Sample toolchain.eclass eval fix
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2008-07-01 16:42:04 UTC
Since you provide only one example, and this example pertains to toolchain.eclass, let's devote this bug to that example. :)
Comment 3 SpanKY gentoo-dev 2008-07-01 17:16:34 UTC
EXTRA_ECONF is treated everywhere as a string.  introducing eval can easily have unintended side effects.

why is setting CXXFLAGS not good enough for you ?  unless there's a real need for such flags in EXTRA_ECONF, it'll stay "broken".
Comment 4 Paul Davis 2008-07-01 21:03:42 UTC
EXTRA_ECONF, anything passed via "$@", quoted multi argument parameters, or (god forbid) a path name with spaces when executed will not parse correctly. The example for gcc compilation was simply one where I first ran into this issue (thus enable-cxx-flags vs. CXXFLAGS is not the point, just a case).

I am attaching two test scripts to validate this approach (as I had reservations as well). This is not so much broken, but merely a method which I am using to configure and compile ebuilds (hence it's classification as an enhancement). Contributed in purely in the spirit of the open source community.
Comment 5 Paul Davis 2008-07-01 21:04:48 UTC
Created attachment 159161 [details]
Test program

Try executing while passing command line parameters as well as setting EXTRA_ECONF
Comment 6 Paul Davis 2008-07-01 21:05:18 UTC
Created attachment 159163 [details]
Bogus configure for test to call
Comment 7 SpanKY gentoo-dev 2013-12-25 08:30:44 UTC
(In reply to Paul Davis from comment #4)

we're completely aware of the limitations of EXTRA_ECONF being treated as a string and not an array.  at this time though, we don't have plans on fixing it because it rarely comes up.

although, it'd be easy to do while being backwards compatible.  just change EXTRA_ECONF in ebuilds to "${EXTRA_ECONF[@]}".  this has nothing to do with `eval` and any suggestions of using `eval` to expand it are doomed to fail.