Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 80971

Summary: Bad data in '/var/cache/edb/virtuals' breaks portage (emerge)
Product: Portage Development Reporter: Dima Diall <ddiall>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Dima Diall 2005-02-06 04:37:49 UTC
I upgrade to the latest Xorg and after that emerge stoped working under root (as a normal user still worked) -- here's the error message:

Traceback (most recent call last):
  File "/usr/bin/emerge", line 14, in ?
    import portage
  File "/usr/lib/portage/pym/portage.py", line 6144, in ?
    do_vartree(settings)
  File "/usr/lib/portage/pym/portage.py", line 6131, in do_vartree
    if not virts_p.has_key(vkeysplit[1]):
IndexError: list index out of range

From the traceback and a quick glimpse through the code I figured that there was something wrong with the 'virtuals' mappings... So I inspected  /var/cache/edb/virtuals and found this line: "opengl? x11-base/xorg-x11".

When the code in /usr/lib/portage/pym/portage.py splits the lines into tokens by "/", the entry corresponding to this line causes problem afterwards (in the key list) and emerge (and probably other tools) crashes.

Reproducible: Always
Steps to Reproduce:
Put a bogus line into '/var/cache/edb/virtuals' such as "opengl? x11-base/xorg-x11", as root execute:

# emerge -vp opengl
Traceback (most recent call last):
  File "/usr/bin/emerge", line 14, in ?
    import portage
  File "/usr/lib/portage/pym/portage.py", line 6144, in ?
    do_vartree(settings)
  File "/usr/lib/portage/pym/portage.py", line 6131, in do_vartree
    if not virts_p.has_key(vkeysplit[1]):
IndexError: list index out of range

Actual Results:  
Emerge doesn't work as root. Probably other tools are affected too.

Expected Results:  
Portage should handle gracefully any kind of crap fed from external data
files... A warning should be issued stating the problem (a corrective action
might be taken or proposed), but processing of this should be skipped.

This bug might lurk in other part of the system... I guess it would be wise to
search for similar "blind bad input data" processing throughout. Unfortunately,
I am not familiar with the details of Portage to solve this issue myself
efficiently.
Comment 1 Nicholas Jones (RETIRED) gentoo-dev 2005-02-06 04:43:19 UTC
That file was obsoleted with portage-2.0.51.
Comment 2 Jason Stubbs (RETIRED) gentoo-dev 2005-02-06 04:54:40 UTC
This is related to portage-2.0.50. In 2.0.51, /var/cache/edb/virtuals doesn't exist any more. Furthermore, what you are seeing with the "invalid" virtuals you have there is a package making use of the new USE-based virtuals feature.

If you sync and see a new version of portage available, you should upgrade - especially if it is a new point release.