Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 67123 - Poor handling of /etc/portage/package.use errors.
Summary: Poor handling of /etc/portage/package.use errors.
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Configuration (show other bugs)
Hardware: x86 Linux
: High minor (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-11 10:05 UTC by LionsPhil
Modified: 2005-08-08 00:50 UTC (History)
3 users (show)

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 LionsPhil 2004-10-11 10:05:11 UTC
If /etc/portage/package.use is malformed in some manner, Portage does not deal with it very gracefully, returning less-than-useful error messages and even crashing with a stack trace. "Garbage In, Garbage Out", yes, but Portage ought to at least catch that there was some kind of problem with /etc/portage/package.use and exit cleanly, preferably with an error message related to /etc/portage.

It's possible that this effects other /etc/portage files.

Reproducible: Always
Steps to Reproduce:
Put something invalid in /etc/portage/package.use. In my case, I had the line:
unreal-tournament-goty -nls
which is missing "games-fps/". Then try to perform an 'emerge' operation (e.g. "emerge -puDv world").
Actual Results:  
panther root # emerge -puDv world

These are the packages that I would merge, in order:

Calculating world dependencies \Traceback (most recent call last):
  File "/usr/bin/emerge", line 2522, in ?
    if not mydepgraph.xcreate(myaction):
  File "/usr/bin/emerge", line 1140, in xcreate
    if not self.create(myk):
  File "/usr/bin/emerge", line 763, in create
    self.pkgsettings.setcpv(mykey)
  File "/usr/lib/portage/pym/portage.py", line 1367, in setcpv
    self.pusekey = best_match_to_list(self.mycpv, self.pusedict.keys())
  File "/usr/lib/portage/pym/portage.py", line 3490, in best_match_to_list
    for x in match_to_list(mypkg,mylist):
  File "/usr/lib/portage/pym/portage.py", line 3477, in match_to_list
    if match_from_list(x,[mypkg]):
  File "/usr/lib/portage/pym/portage.py", line 3530, in match_from_list
    cat,pkg = catsplit(mycpv)
ValueError: unpack list of wrong size
panther root # emerge -pv gimp

These are the packages that I would merge, in order:

Calculating dependencies \
!!! Problem in media-gfx/gimp dependencies.
!!! unpack list of wrong size
panther root #

Expected Results:  
Some kind of sensible error message, such as "!!! /etc/portage/package.use 
invalid" or even just "!!! Error reading Portage configuration".

Portage 2.0.50-r11 (default-x86-1.4, gcc-3.3.4, glibc-2.3.3.20040420-r2, 2.6.8-
gentoo-r3)
=================================================================
System uname: 2.6.8-gentoo-r3 i686 Mobile Intel(R) Celeron(R) CPU 1.80GHz
Gentoo Base System version 1.4.16
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=i686 -funroll-loops -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3/
share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=i686 -funroll-loops -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="ftp://ftp.heanet.ie/pub/gentoo/ http://mirrors.sec.informatik.
tu-darmstadt.de/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.uk.gentoo.org/gentoo-portage"
USE="X aalib alsa apm avi berkdb bitmap-fonts crypt cups dga divx4linux f77 
fbcon foomaticdb gdbm gif gpm gtk gtk2 guile jack jack-tmpfs java jikes jpeg 
libcaca libg++ libwww mad mikmod mmx mng motif mpeg ncurses nls oggvorbis opengl 
pam pcmcia pdflib perl png pnp python qt quicktime readline ruby sdl slang spell 
sse ssl svg svga tcltk tcpd tiff truetype unicode usb wmf x86 xml xml2 xmms 
xprint xv xvid zlib"
Comment 1 Max 2005-07-14 03:41:38 UTC
Can I just add to this that comments in package.use also do not work as
expected. In the portage man page, it says

package.use
[...]
Format:
- comments begin with #

In fact, portage will attempt to parse words following a hash as useflags like
in the following example:
package.use:
www-client/elinks -guile # Removed guile support 2004/12/14

This will actually pick up the second "guile", and attempt to compile elinks
*with* guile support. Highly confusing, and hard to track down.
Comment 2 Marius Mauch (RETIRED) gentoo-dev 2005-07-14 10:31:39 UTC
comments have to be on a line of their own.
Comment 3 Zac Medico gentoo-dev 2005-08-01 13:57:34 UTC
This could go along with Bug 66941.
Comment 4 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2005-08-06 12:53:35 UTC
I don't have this problem, the error message looks like this:
--- Invalid atom in /etc/portage/package.use: <atom>

Portage 2.0.51.22-r2 (hardened/x86/2.6, gcc-3.4.4, glibc-2.3.5-r0,
2.6.11-hardened-r15 i686)
=================================================================
System uname: 2.6.11-hardened-r15 i686 Intel(R) Celeron(R) CPU 2.40GHz
Gentoo Base System version 1.6.13
dev-lang/python:     2.3.5
sys-apps/sandbox:    1.2.11
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.18-r1
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-Os -march=pentium4 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env
/usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-Os -march=pentium4 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig collision-protect distlocks fixpackages sandbox sfperms
strict test userpriv usersandbox"
GENTOO_MIRRORS="http://src.gentoo.pl
http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/
http://gentoo.zie.pg.gda.pl ftp://130.59.10.34/mirror/gentoo/
http://212.219.56.162/sites/www.ibiblio.org/gentoo/
http://212.219.56.131/sites/www.ibiblio.org/gentoo/
http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/
ftp://ftp.citkit.ru/pub/Linux/gentoo
http://212.219.56.146/sites/www.ibiblio.org/gentoo/
ftp://ftp.dtiltas.lt/mirror/gentoo/"
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
LDFLAGS="-Wl,-O1"
LINGUAS="en pl"
PKGDIR="/usr/portage//packages/x86/"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage/"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X acl acpi alsa arts avi bash-completion berkdb bitmap-fonts cdparanoia cdr
crypt cups curl dlloader encode esd fam foomaticdb ftp gdbm gif gimpprint glx
gtk gtk2 hal hardened imagemagick java jpeg junit kde ldap mad mikmod mime mmx
motif mysql ncurses nls nptl nvidia ogg oggvorbis opengl pam perl pic pie png
posix python qt readline samba scanner sdl slang spell sse sse2 ssl svg svga
tcpd tiff truetype-fonts type1-fonts usb userlocales vorbis wmf x86 xml2 xmms xv
zlib linguas_en linguas_pl userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, MAKEOPTS, PORTDIR_OVERLAY
Comment 5 LionsPhil 2005-08-08 00:50:47 UTC
Yes, I believe that this has been fixed at some point but not marked as such.

Trying to do so, even though I'm not a dev...