Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 118191 - portageq envvar without arguments gives a stacktrace
Summary: portageq envvar without arguments gives a stacktrace
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 115839
  Show dependency tree
 
Reported: 2006-01-07 08:50 UTC by Petteri Räty (RETIRED)
Modified: 2006-02-26 14:46 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petteri Räty (RETIRED) gentoo-dev 2006-01-07 08:50:53 UTC
From 2.0.53:
betelgeuse@aria ~ $ portageq envvar
Traceback (most recent call last):
  File "/usr/bin/portageq", line 253, in ?
    main()
  File "/usr/bin/portageq", line 248, in main
    function(sys.argv[2:])
  File "/usr/bin/portageq", line 197, in envvar
    print portage.settings[argv[0]]
IndexError: list index out of range

From 2.1_pre3-r1:
betelgeuse@pena ~/bin $ portageq envvar
Traceback (most recent call last):
  File "/usr/bin/portageq", line 282, in ?
    main()
  File "/usr/bin/portageq", line 277, in main
    function(sys.argv[2:])
  File "/usr/bin/portageq", line 206, in envvar
    if (argv[0] == "-v"):
IndexError: list index out of range

Instead of failing portageq should give the user help instructions on how to use the program.

Portage 2.1_pre3-r1 (default-linux/x86/2005.1, gcc-3.4.5, glibc-2.3.5-r3, 2.6.15-gentoo i686)
=================================================================
System uname: 2.6.15-gentoo i686 Intel(R) Pentium(R) 4 CPU 2.40GHz
Gentoo Base System version 1.12.0_pre13
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [enabled]
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium4 -pipe -mfpmath=sse -ffast-math -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/share/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/splash /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium4 -pipe -mfpmath=sse -ffast-math -fomit-frame-pointer"
DISTDIR="/usr/src/distfiles"
FEATURES="autoaddcvs autoconfig ccache collision-protect cvs distlocks fixpackages sandbox sfperms sign strict stricter verify-rdepend"
GENTOO_MIRRORS=" http://trumpetti.atm.tut.fi/gentoo  http://lame.lut.fi/linux/gentoo "
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
LINGUAS="fi"
MAKEOPTS="-j2 "
PKGDIR="/home/pkg/"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/mnt/checkouts/overlays/betelgeuse"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 aac acl acpi alsa apm arts audiofile avi bash-completion berkdb bitmap-fonts bluetooth bzip2 bzlib cdb cddb cdparanoia cdr crypt cups curl dbus divx4linux dts dvd dvdr dvdread emboss esd exif expat fam ffmpeg firefox foomaticdb freetype gif glut gmp gstreamer gtk2 hal idn imagemagick java jpeg kde kdeenablefinal lcms libg++ libwww logitech-mouse mad makecheck mikmod mjpeg mmx mmx2 mng mp3 mpeg ncurses network nptl nptlonly nsplugin nvidia offensive ogg oggvorbis opengl pam pcre pdflib png qt quicktime readline real rtc ruby samba spell sqlite sse sse2 ssl subversion svg symlink tcpd theora tiff truetype truetype-fonts type1-fonts udev unicode usb userlocales vorbis win32codecs xine xml xml2 xv xvid zlib elibc_glibc kernel_linux linguas_fi userland_GNU video_cards_nvidia"
Unset:  ASFLAGS, CTARGET, LDFLAGS
Comment 1 solar (RETIRED) gentoo-dev 2006-01-07 09:07:57 UTC
Not sure that it should print anything if no argv

How about 

--- /usr/bin/portageq.orig      2006-01-07 17:01:40.000000000 +0000
+++ /usr/bin/portageq   2006-01-07 17:01:50.000000000 +0000
@@ -194,7 +194,8 @@
        Returns a specific environment variable as exists prior to ebuild.sh.
        Similar to: emerge --verbose --info | egrep '^<variable>='
        """
-       print portage.settings[argv[0]]
+       if len(argv):
+               print portage.settings[argv[0]]
 
 
 #-----------------------------------------------------------------------------
Comment 2 solar (RETIRED) gentoo-dev 2006-01-07 09:16:48 UTC
or
+       if len(argv):
+               print portage.settings[argv[0]]
+       else:
+               print envvar.__doc__
Comment 3 Brian Harring (RETIRED) gentoo-dev 2006-01-08 04:43:20 UTC
insvn.  pukes if no arg is supplied
Comment 4 Zac Medico gentoo-dev 2006-02-26 14:46:56 UTC
Released in 2.1_pre4.