Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 381705 - Portage 2.1.10.3 failed with "AttributeError: 'dict' object has no attribute 'append'"
Summary: Portage 2.1.10.3 failed with "AttributeError: 'dict' object has no attribute ...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 381649
  Show dependency tree
 
Reported: 2011-09-03 17:59 UTC by Dirk Tilger
Modified: 2011-09-04 01:09 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 Dirk Tilger 2011-09-03 17:59:41 UTC
I just synced my tree and after it, portage failed with:

-----8<------
Performing Global Updates:
(Could take a couple of minutes if you have a lot of binary packages.)
  .='update pass'  *='binary update'  #='/var/db update'  @='/var/db move'
  s='/var/db SLOT move'  %='binary move'  S='binary SLOT move'
  p='update /etc/portage/package.*'
/usr/portage/profiles/updates/3Q-2011..................
/var/cache/edb/vdb_metadata.pickle
Traceback (most recent call last):
  File "/usr/bin/emerge", line 43, in <module>
    retval = emerge_main()
  File "/usr/lib64/portage/pym/_emerge/main.py", line 1532, in emerge_main
    _global_updates(trees, mtimedb["updates"], quiet=("--quiet" in myopts)):
  File "/usr/lib64/portage/pym/portage/_global_updates.py", line 206, in _global_updates
    repo_map, match_callback=_config_repo_match)
  File "/usr/lib64/portage/pym/portage/update.py", line 288, in update_config_files
    if match_callback(repo_name, atom, new_atom):
  File "/usr/lib64/portage/pym/portage/_global_updates.py", line 199, in _config_repo_match
    repository = vardb.aux_get(best(matches), ['repository'])[0]
  File "/usr/lib64/portage/pym/portage/dbapi/vartree.py", line 629, in aux_get
    pkg_data = self._aux_cache["packages"].get(mycpv)
  File "/usr/lib64/portage/pym/portage/dbapi/vartree.py", line 531, in _aux_cache
    self._aux_cache_init()
  File "/usr/lib64/portage/pym/portage/dbapi/vartree.py", line 554, in _aux_cache_init
    aux_cache = mypickle.load()
AttributeError: 'dict' object has no attribute 'append'
-----8<------

The cause of the problem might have been file-system damage I encountered a few months back. 

As far as I understand it, the cPickler deserializes some python structures saved into a file and raises an AttributeError when trying to restore an errounously saved structure.

When investigating the problem I found that portage has in principle a mechanism for recovering from this condition. When I include the AttributeError in the exception handler below (and for convenience of debugging also into the file printing code in the exception handler) the operation seemingly succeeds:

-----8<-----
topo dirk # emerge -s smart
--- Invalid atom in /etc/portage/package.keywords: app-portage/dev-python/cheetah
--- Invalid atom in /etc/portage/package.keywords: cross-arm-eabi-/[latest]
--- Invalid atom in /etc/portage/package.keywords: cross-arm-none-symbianelf/[stable]
--- Invalid atom in /etc/portage/package.keywords: cross-arm-eabi/[latest]

Performing Global Updates:
(Could take a couple of minutes if you have a lot of binary packages.)
  .='update pass'  *='binary update'  #='/var/db update'  @='/var/db move'
  s='/var/db SLOT move'  %='binary move'  S='binary SLOT move'
  p='update /etc/portage/package.*'
/usr/portage/profiles/updates/3Q-2011..................
!!! Error loading '/var/cache/edb/vdb_metadata.pickle': 'dict' object has no attribute 'append'
p###

--- Invalid atom in /etc/portage/package.keywords: app-portage/dev-python/cheetah
--- Invalid atom in /etc/portage/package.keywords: cross-arm-eabi-/[latest]
--- Invalid atom in /etc/portage/package.keywords: cross-arm-none-symbianelf/[stable]
--- Invalid atom in /etc/portage/package.keywords: cross-arm-eabi/[latest]
Searching...   -!!! Error loading '/var/cache/edb/vdb_metadata.pickle': 'dict' object has no attribute 'append'
  
[ Results for search key : smart ]
[ Applications found : 15 ]

*  app-admin/ide-smart
-----8<-----

The aforementioned exception handler then looks (sorry for not having a patch):
-----8<-----
 556                 except (IOError, OSError, EOFError, ValueError, pickle.UnpicklingError, AttributeError) as e:
 557                         if isinstance(e, pickle.UnpicklingError) or isinstance(e, AttributeError):
 558                                 writemsg(_unicode_decode(_("!!! Error loading '%s': %s\n")) % \
 559                                         (self._aux_cache_filename, e), noiselevel=-1)
 560                         del e
-----8<-----

Reproducible: Always
Comment 2 Zac Medico gentoo-dev 2011-09-04 01:09:52 UTC
This is fixed in 2.1.10.13 and 2.2.0_alpha53.