portageq portdir on the bash command line returns /usr/portage Now calling: (Same bash session) eselect profile list returns: /bin/sed: can't read //profiles/profiles.desc: No such file or directory !!! Error: Failed to get a list of valid profiles. Debuging eselect.profile and the call to portageq portdir from inside the script returns nothing. (portdir=${portageq portdir} Afraid I'm just a jack of all coder, so I'm no expert in this scripting language and can't understand why it would return nothing from inside the script, but work fine otherwise. Reproducible: Always Portage 2.2_rc8 (default/linux/x86/2008.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.24-gentoo-r8-blaze i686) ================================================================= System uname: Linux-2.6.24-gentoo-r8-blaze-i686-Intel-R-_Pentium-R-_4_CPU_3.00GHz-with-glibc2.0 Timestamp of tree: Sun, 21 Sep 2008 06:45:05 +0000 ccache version 2.4 [enabled] app-shells/bash: 3.2_p33 dev-lang/python: 2.5.2-r7 dev-util/ccache: 2.4-r7 sys-apps/baselayout: 1.12.11.1 sys-apps/sandbox: 1.2.18.1-r2 sys-devel/autoconf: 2.13, 2.61-r2 sys-devel/automake: 1.5, 1.9.6-r2, 1.10.1 sys-devel/binutils: 2.18-r3 sys-devel/gcc-config: 1.4.0-r4 sys-devel/libtool: 1.5.26 virtual/os-headers: 2.6.23-r3 ACCEPT_KEYWORDS="x86" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=nocona -pipe -fomit-frame-pointer -msse3" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /var/bind" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d" CXXFLAGS="-O2 -march=nocona -pipe -fomit-frame-pointer -msse3" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--ask --usepkg --reinstall changed-use --update --deep --with-bdeps=y" FEATURES="buildpkg ccache distlocks fixpackages parallel-fetch preserve-libs sandbox sfperms strict unmerge-orphans userfetch" GENTOO_MIRRORS="ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/ http://gentoo.osuosl.org/ http://mirror.espri.arizona.edu/gentoo/" LDFLAGS="-Wl,-O1" LINGUAS="en da" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" 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" SYNC="rsync://128.213.5.35/gentoo-portage" USE="doc emacs fam gnutls idn ipv6 ithreads nls nptl nptlonly pam readline sse sse2 ssl tcpd tetex threads unicode x86 xinetd" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en da" USERLAND="GNU" VIDEO_CARDS="fbdev glint i810 mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa vga via vmware voodoo" Unset: CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
This is really starting to bug me, I have several machines that gets nothing when they call portageq. Latest example. icecream calls gcc-config when it's setting up, but if python -V &>/dev/null ; then export REAL_CHOST=$(env -i portageq envvar CHOST 2>/dev/null) fi This code fails from inside the script. env -i portageq envvar CHOST returns nothing, but works fine on the command line. I keep having to add stupid work arounds like, like here where I instead of an else, made another if checking if REAL_CHOST actually got populated with the above code. if [[ -z ${REAL_CHOST} ]] ; then ewarn "Python seems to be broken, attempting to locate CHOST ourselves ..." export REAL_CHOST=$(try_real_hard_to_find_CHOST) fi This latest failure is a freshly 100% handbook 64 bit Gentoo, I just created in a virtual machine and I can't for the life of me explain why portageq doesn't work from scripts.
I can't reproduce this, must have been an improperly assigned portage bug. %% cat tmp/test.sh if python -V &>/dev/null ; then echo $(env -i portageq envvar CHOST 2>/dev/null) fi %% bash !$ bash tmp/test.sh x86_64-pc-linux-gnu