Created attachment 338850 [details] use eval to assign parameters passed via EXTRA_ECONF correctly sys-apps/portage-2.1.11.{50,51} at least do not pass parameters specified via EXTRA_ECONF correctly, if the values assigned to these parameters do contain spaces. Example: sudo EXTRA_ECONF="--with-something='a b c d'" xyz.ebuild configure I hit this problem when running the following command: $ sudo FEATURES=test EXTRA_ECONF="--with-mssql-driver='SQL Server Native Client 11.0' --with-mssql-server=example.com" USE='mssql -postgres' ebuild odb-tests-2.2.0_pre3.ebuild manifest clean test [...] /var/tmp/portage/dev-db/odb-tests-2.2.0_pre3/work/odb-tests-2.2.0_pre3/configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --disable-dependency-tracking --docdir=/usr/share/doc/odb-tests-2.2.0_pre3 --enable-shared --disable-static --with-database=mssql --enable-threads --with-mssql-driver='SQL Server Native Client 11.0' --with-mssql-server=example.com configure: WARNING: you should use --build, --host, --target configure: WARNING: you should use --build, --host, --target configure: WARNING: you should use --build, --host, --target configure: WARNING: you should use --build, --host, --target configure: WARNING: invalid host type: 11.0' configure: loading site script /usr/share/config.site checking for a BSD-compatible install... /usr/bin/install -c [...] While the echoed command line appears to be correct, the parameter list finally passed to the configure script is wrong. Especially "configure: WARNING: invalid host type: 11.0'" gave me a clue what actually happened. After this problem did not occur when I did run command line exactly as it was echoed above within an interactive shell, I tracked it down to ${EXTRA_ECONF} apparently being underquoted in /usr/lib/portage/bin/phase-helpers.sh : 497 set -- \ 498 --prefix="${EPREFIX}"/usr \ 499 ${CBUILD:+--build=${CBUILD}} \ 500 --host=${CHOST} \ 501 ${CTARGET:+--target=${CTARGET}} \ 502 --mandir="${EPREFIX}"/usr/share/man \ 503 --infodir="${EPREFIX}"/usr/share/info \ 504 --datadir="${EPREFIX}"/usr/share \ 505 --sysconfdir="${EPREFIX}"/etc \ 506 --localstatedir="${EPREFIX}"/var/lib \ 507 "$@" \ 508 ${EXTRA_ECONF} 509 __vecho "${ECONF_SOURCE}/configure" "$@" 510 511 if ! "${ECONF_SOURCE}/configure" "$@" ; then However, the fix does not consist in also quoting ${EXTRA_ECONF}, because then all parameters contained therein are passed as a single one to configure, which would be wrong again with several parameters in EXTRA_ECONF. I've attached a patch which fixed the problem for me. It introduces eval to build and run the configure command line: - if ! "${ECONF_SOURCE}/configure" "$@" ; then + if ! eval "${ECONF_SOURCE}/configure" "$@" ; then The ebuild I used to demonstrate the problem is not part of the portage tree. However, you can try it with any ebuild. Below I picked app-editory/vim: $ sudo FEATURES=test EXTRA_ECONF="--with-mssql-driver='SQL Server Native Client 11.0' --with-mssqlerver=example.com" USE='mssql -postgres' ebuild /usr/portage/app-editors/vim/vim-7.3.762.ebuild manifest clean test [...] ./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --with-features=huge --enable-multibyte --disable-cscope --enable-gpm --disable-perlinterp --disable-pythoninterp --disable-rubyinterp --enable-gui=no --disable-darwin --with-x --enable-nls --enable-acl --with-tlib=curses --disable-selinux --with-modified-by=Gentoo-7.3.762 --with-mssql-driver='SQL Server Native Client 11.0' --with-mssql-server=example.com configure: WARNING: you should use --build, --host, --target configure: WARNING: you should use --build, --host, --target configure: WARNING: you should use --build, --host, --target configure: WARNING: you should use --build, --host, --target configure: WARNING: invalid host type: 11.0' configure: WARNING: unrecognized options: --with-mssql-driver, --with-mssql-server configure: loading site script /usr/share/config.site [...] Whith "eval" in place this too becomes: ./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --with-features=huge --enable-multibyte --disable-cscope --enable-gpm --disable-perlinterp --disable-pythoninterp --disable-rubyinterp --enable-gui=no --disable-darwin --with-x --enable-nls --enable-acl --with-tlib=curses --disable-selinux --with-modified-by=Gentoo-7.3.762 --with-mssql-driver='SQL Server Native Client 11.0' --with-mssql-server=example.com configure: WARNING: unrecognized options: --with-mssql-driver, --with-mssql-server configure: loading site script /usr/share/config.site I wonder if Bug #356997 has a similar cause.
Created attachment 338880 [details, diff] eval EXTRA_ECONF to an array The patch gives the intended result, without changing the interpretation of arguments passed directly to econf (important for compliance with app-doc/pms). Here's a little demonstration script to show that this approach works: #!/usr/bin/env bash EXTRA_ECONF="--with-mssql-driver='SQL Server Native Client 11.0' --with-mssql-server=example.com" econf_demo() { eval "local -a EXTRA_ECONF=(${EXTRA_ECONF})" for x in "${EXTRA_ECONF[@]}" ; do echo "${x}" ; done } econf_demo
(In reply to comment #1) > The patch gives the intended result, without changing the interpretation of > arguments passed directly to econf (important for compliance with > app-doc/pms). Yes, this solves the the problem here too. Yet I observe a a small difference: $ sudo [...] --with-mssql-server=example.com --with-mssql-driver=SQL Server Native Client 11.0 Note the missing single quotes when the command line gets logged by __vecho. However, this is only a defective appearance -- what you see is worrying, but what you get is right.
This is in git: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e62aa344cba45aca2f317ecaae025ed4240659fd (In reply to comment #2) > Note the missing single quotes when the command line gets logged by __vecho. > However, this is only a defective appearance -- what you see is worrying, > but what you get is right. I suppose we could add a __vecho option that makes it quote the arguments it's given, or a new function for that.
This is fixed in 2.1.11.53 and 2.2.0_alpha164.