Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 348360 - econf "${myconf}" badness
Summary: econf "${myconf}" badness
Status: RESOLVED INVALID
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-10 12:46 UTC by Martin Mokrejš
Modified: 2010-12-10 16:53 UTC (History)
0 users

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


Attachments
wcd-0.6.0.ebuild (wcd-0.6.0.ebuild,1.04 KB, text/plain)
2010-12-10 12:47 UTC, Martin Mokrejš
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Mokrejš 2010-12-10 12:46:03 UTC
Hi,
  it took me a while to figure out why configure complained that I did not specify a host target type. Below are two bad approaches.

In the first case below you can see there were two spaces in front of the '--enable-mpi' and that configure complained that econf did not provide --target, which it never does for me so (tested with coreutils package behaviour)) doubt in this particular case it is really necessary.

The second is just an attempt to avoid two spaces in front of '--enable-mpi' (successfull, so do not look for the two spaces there) but the configure broke completely.


Case 1:

src_compile(){
    local myconf=""
    if use mpi; then
        myconf="${myconf} --enable-mpi"
    fi

    if use threads; then
        myconf="${myconf} --enable-pthreads"
    fi

    econf "${myconf}" || die


[cut]

>>> Emerging (1 of 1) sci-biology/wcd-0.6.0 from science
 * wcd-0.6.0.tar.gz RMD160 SHA1 SHA256 size ;-) ...                                                                                                                                                                            [ ok ]
 * Package:    sci-biology/wcd-0.6.0
 * Repository: science
 * Maintainer: mmokrejs@gentoo.org sci-biology@gentoo.org
 * USE:  elibc_glibc kernel_linux mpi threads userland_GNU x86
>>> Unpacking source...
>>> Unpacking wcd-0.6.0.tar.gz to /var/tmp/portage/sci-biology/wcd-0.6.0/work
>>> Source unpacked in /var/tmp/portage/sci-biology/wcd-0.6.0/work
>>> Compiling source in /var/tmp/portage/sci-biology/wcd-0.6.0/work/wcd-0.6.0 ...
 * econf: updating wcd-0.6.0/config.guess with /usr/share/gnuconfig/config.guess
 * econf: updating wcd-0.6.0/config.sub with /usr/share/gnuconfig/config.sub
./configure --prefix=/usr --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib  --enable-mpi --enable-pthreads
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --enable-mpi --enable-pthreads

[cut]

# cp /var/tmp/portage/sci-biology/wcd-0.6.0/work/wcd-0.6.0/config.guess /tmp/config.guess_invalid_host
# cp /var/tmp/portage/sci-biology/wcd-0.6.0/work/wcd-0.6.0/config.sub /tmp/config.sub_invalid_host




Case 2:

src_compile(){
    local myconf=""
    if use mpi; then
        myconf="--enable-mpi"
    fi

    if use threads; then
        myconf="${myconf} --enable-pthreads"
    fi

    econf "${myconf}" || die

[cut]


>>> Emerging (1 of 1) sci-biology/wcd-0.6.0 from science
 * wcd-0.6.0.tar.gz RMD160 SHA1 SHA256 size ;-) ...                                                                                                                                                                            [ ok ]
 * Package:    sci-biology/wcd-0.6.0
 * Repository: science
 * Maintainer: mmokrejs@gentoo.org sci-biology@gentoo.org
 * USE:  elibc_glibc kernel_linux mpi threads userland_GNU x86
>>> Unpacking source...
>>> Unpacking wcd-0.6.0.tar.gz to /var/tmp/portage/sci-biology/wcd-0.6.0/work
>>> Source unpacked in /var/tmp/portage/sci-biology/wcd-0.6.0/work
>>> Compiling source in /var/tmp/portage/sci-biology/wcd-0.6.0/work/wcd-0.6.0 ...
 * econf: updating wcd-0.6.0/config.guess with /usr/share/gnuconfig/config.guess
 * econf: updating wcd-0.6.0/config.sub with /usr/share/gnuconfig/config.sub
./configure --prefix=/usr --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --enable-mpi --enable-pthreads
configure: error: invalid feature name: mpi --enable-pthreads
 * ERROR: sci-biology/wcd-0.6.0 failed:
 *   econf failed
 * 
 * Call stack:
 *     ebuild.sh, line   56:  Called src_compile
 *   environment, line 2674:  Called econf '--enable-mpi --enable-pthreads'

[cut]

# cp /var/tmp/portage/sci-biology/wcd-0.6.0/work/wcd-0.6.0/config.guess /tmp/config.guess_invalid_feature_mpi
# cp /var/tmp/portage/sci-biology/wcd-0.6.0/work/wcd-0.6.0/config.sub /tmp/config.sub_invalid_feature_mpi


In the end, I found out that I have extra double quotes on the econf line.
Is there anything ebuild(1) or less preferably repoman(1) or other tool could do for me?
Comment 1 Martin Mokrejš 2010-12-10 12:47:36 UTC
Created attachment 256829 [details]
wcd-0.6.0.ebuild

A testcase ebuild. Actually, in its fixed form but you can easily add the missing quotes to play with this.
Comment 2 Martin Mokrejš 2010-12-10 12:48:08 UTC
$ emerge --info
Portage 2.1.9.25 (default/linux/x86/10.0/desktop, gcc-4.5.1, glibc-2.12.1-r3, 2.6.27.56 i686)
=================================================================
System uname: Linux-2.6.27.56-i686-Mobile_Intel-R-_Pentium-R-_4_-_M_CPU_1.80GHz-with-gentoo-2.0.1
Timestamp of tree: Thu, 09 Dec 2010 18:45:03 +0000
distcc 3.1 i686-pc-linux-gnu [enabled]
app-shells/bash:     4.1_p9
dev-java/java-config: 1.3.7-r1, 2.1.11-r2
dev-lang/python:     2.5.4-r4, 2.6.6-r1, 2.7.1, 3.1.3
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1-r1
sys-apps/openrc:     0.6.7
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.13::<unknown repository>, 2.68
sys-devel/automake:  1.4_p6-r1, 1.5-r1, 1.6.3-r1, 1.7.9-r2, 1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       3.3.6-r1, 4.2.4-r1, 4.3.5, 4.4.5, 4.5.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.4-r1
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.36.1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="x86 ~x86"
ACCEPT_LICENSE="* -@EULA dlj-1.1 sun-bcla-java-vm Nero-EULA-US skype-eula AdobeFlash AdobeFlash-10 AdobeFlash-10.1"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium4 -mmmx -msse -msse2 -pipe -fno-strict-aliasing -ggdb"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/bind /var/lib/hsqldb /var/qmail/alias /var/qmail/control /var/vpopmail/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=pentium4 -mmmx -msse -msse2 -pipe -fno-strict-aliasing -ggdb"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distcc distlocks fixlafiles fixpackages metadata-transfer news nostrip parallel-fetch protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://gentoo.mirror.web4u.cz"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en cs cz"
MAKEOPTS="-j6"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /home/mmokrejs/proj/sci"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="32bit 7zip R X Xaw3d a52 aac aalib ace acl acpi alsa amr amrnb amrwb apache audacious audiofile bash-completion bcmath berkdb blas bluetooth boost branding bzip2 cairo caps cblas cddb cdparanoia cdr cgi clamav cli colordiff compress consolekit cpio cracklib crypt cscope css ctype cups curl curlwrappers cxx dbi dbus dga dia directfb djbfft dri dts dv dvb dvd dvdr dvdread emboss emf enblend encode enscript exif expat faad fam fame fat fbcon ffmpeg fftw firefox flac flash fontconfig fortran fpx ftp gcj gd gdbm ggi gif gimp gimpprint glibc-compat20 glibc-omitfp glut gmp gnuplot gnutls gpgme gphoto2 gpm graphviz gs gsl gsm gtk gtkhtml hal hdf hdf5 hp2xx i8x0 icc iconv icu id3 id3tag ieee1394 imagemagick imlib inifile innodb ithreads jack java javascript jbig jce jikes jpeg jpeg2k kdtree kerberos ladspa lame lapack laptop lcms leim libcaca libnotify libwww live lzo lzw mad maildir matroska mhash mikmod mime ming mjpeg mmap mmx mng mod_python modperl modplug modules motif mozilla moznoirc mp2 mp3 mp4 mpeg mpi mpi_njtree mpich2 mplayer mudflap mule musepack mxdatetime mysql mysqli nat ncurses netcdf netpbm network nls nntp nptl nptlonly nsplugin ntfs numeric objc ogg opengl openmp openssl pam pango pcmcia pcntl pcre pdf perl plotutils plugin png pnm postproc postscript ppds pppd procmail pymol python qt3support qt4 quicktime rar raw readline recode reiserfs romio rpm samba sasl scanner scp sdl seamonkey server session sftp sift slp smime sndfile soap sockets spell sqlite srt sse sse2 ssl startup-notification static-libs subtitles subversion svg svgz sysfs sysvipc t1lib tcl tcpd theora threads tidy tiff tk transcode truetype unicode urandom usb userlocales utils uuencode v4l v4l2 vcd vhook vim-syntax vim-with-x vorbis wavpack wifi win32codecs wmf wxwindows x264 x86 xanim xcb xcf xfs xft xinerama xinetd xml xorg xpm xsl xslt xulrunner xv xvid xvmc yv12 zip zlib" ALSA_CARDS="intel-8x0m" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config mem_cache mime mime_magic rewrite setenvif speling status unique_id userdir usertrack vhost_alias negotiation" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en cs cz" PHP_TARGETS="php5-2" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-12-10 13:01:47 UTC
(In reply to comment #0)
>     econf "${myconf}" || die

This is incorrect. You are passing all the arguments as a single arg. You should not quote ${myconf}, or use an array.
Comment 4 Martin Mokrejš 2010-12-10 13:06:27 UTC
I merely ;) understand but wonder:
- why it breaks in the way so that configure claims no --target was specified, which is puzzling
- I still think there could be a check that quotes are on an econf line

But, as you wish. ;)
Comment 5 Zac Medico gentoo-dev 2010-12-10 13:18:19 UTC
(In reply to comment #4)
> I merely ;) understand but wonder:
> - why it breaks in the way so that configure claims no --target was specified,
> which is puzzling

The call stack in the die message makes it obvious that there is a quoting problem in the econf call:

* ERROR: sci-biology/wcd-0.6.0 failed:
 *   econf failed
 * 
 * Call stack:
 *     ebuild.sh, line   56:  Called src_compile
 *   environment, line 2674:  Called econf '--enable-mpi --enable-pthreads'

> - I still think there could be a check that quotes are on an econf line

Such a check is not necessary because the problem is easy to diagnose as said above.
Comment 6 Martin Mokrejš 2010-12-10 13:29:07 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > I merely ;) understand but wonder:
> > - why it breaks in the way so that configure claims no --target was specified,
> > which is puzzling
> 
> The call stack in the die message makes it obvious that there is a quoting
> problem in the econf call:
> 
> * ERROR: sci-biology/wcd-0.6.0 failed:
>  *   econf failed
>  * 
>  * Call stack:
>  *     ebuild.sh, line   56:  Called src_compile
>  *   environment, line 2674:  Called econf '--enable-mpi --enable-pthreads'

You mean as there is no '--prefix=/usr --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib' as well on that line I should have realized a quoting problem on the econf line?

Well, I am an ebuild-writing newbie so I really do not want to argue. Just wanted to give some feedback because it was tricky to me. Of course it takes a while until one learns how to interpret error messages. Will try to take care of it myself. ;-)
Comment 7 Zac Medico gentoo-dev 2010-12-10 13:33:04 UTC
No, the key thing to notice is that '--enable-mpi --enable-pthreads' is invalid since you should never have more than one --foo-bar option inside a pair of quotes like that.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-12-10 13:39:34 UTC
(In reply to comment #4)
> - why it breaks in the way so that configure claims no --target was specified,
> which is puzzling

It doesn't claim it was not specified. It just notices unmatched arg, which way host was specified in the past.

In other words, if you run configure like the following:
$ ./configure i686-pc-linux-gnu

You'll notice configure uses that and complains in the same way. The same is going to happen if you pass totally random, non-argument junk.
Comment 9 Martin Mokrejš 2010-12-10 13:54:31 UTC
(In reply to comment #7)
> No, the key thing to notice is that '--enable-mpi --enable-pthreads' is invalid
> since you should never have more than one --foo-bar option inside a pair of
> quotes like that.

I see what you meant with the list previously ..., so what I would be thinking of doing is something about:

if not isinstance(_myvar, list):
    if (isinstance(_myvar, stringtype) and not len(_myvar.split("'")) == 2):
    raise
else:
    if len(_myvar) == 1 and "'" in _myvar[0]:
        raise


It is not carefully coded and I see cases when it will break .. but I know I will not convince you anyway ... .;) But I got your points.
Comment 10 Martin Mokrejš 2010-12-10 13:59:12 UTC
(In reply to comment #8)
> (In reply to comment #4)
> > - why it breaks in the way so that configure claims no --target was specified,
> > which is puzzling
> 
> It doesn't claim it was not specified. It just notices unmatched arg, which
> way host was specified in the past.
> 
> In other words, if you run configure like the following:
> $ ./configure i686-pc-linux-gnu
> 
> You'll notice configure uses that and complains in the same way. The same is
> going to happen if you pass totally random, non-argument junk.

Yes, and that is where portage could pre-filter the input from the 'user', because configure is careless and just breaks e.g. --enable-mpi into just 'mpi' and one just dreams about some ugly magic behind breaking on `-' separators. And portage just allows me to exploit such bugs while it could be helpful. ;)
Comment 11 Zac Medico gentoo-dev 2010-12-10 14:05:42 UTC
Seriously, it's jut not worth it to add code to try to detect these kinds of errors when they're easy enough to diagnose with a little experience.
Comment 12 Fabian Groffen gentoo-dev 2010-12-10 14:30:17 UTC
it's similar to unpack "${A}" (which is wrong also)
Comment 13 SpanKY gentoo-dev 2010-12-10 16:53:55 UTC
(In reply to comment #11)

+1