Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 223591 - FEATURES="preserve-libs": KeyError: '${LIBRARY} not in object list'
Summary: FEATURES="preserve-libs": KeyError: '${LIBRARY} not in object list'
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: High normal
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2008-05-25 18:03 UTC by Arfrever Frehtes Taifersar Arahesis (RETIRED)
Modified: 2008-06-10 16:04 UTC (History)
1 user (show)

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


Attachments
/var/cache/edb/library_consumers (library_consumers.bz2,83.20 KB, application/octet-stream)
2008-05-25 18:06 UTC, Arfrever Frehtes Taifersar Arahesis (RETIRED)
Details
/var/lib/portage/preserved_libs_registry (preserved_libs_registry,304 bytes, application/octet-stream)
2008-05-25 18:07 UTC, Arfrever Frehtes Taifersar Arahesis (RETIRED)
Details
linkmap (linkmap.bz2,514.33 KB, application/octet-stream)
2008-05-31 17:43 UTC, Arfrever Frehtes Taifersar Arahesis (RETIRED)
Details
linkmap (linkmap.bz2,586.41 KB, application/octet-stream)
2008-06-07 22:01 UTC, Arfrever Frehtes Taifersar Arahesis (RETIRED)
Details
Patch to correct the scanelf call for preserved libs (preserved-libs-scan.diff,800 bytes, patch)
2008-06-08 13:36 UTC, Marius Mauch (RETIRED)
Details | Diff
Patch to correct scanelf call and symlink preservation issue (preserved-libs-scan.diff,2.02 KB, patch)
2008-06-08 13:57 UTC, Marius Mauch (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2008-05-25 18:03:43 UTC
I have Portage r10416.
I upgraded sys-devel/gcc-4.2.3 to sys-devel/gcc-4.2.4:
!! existing preserved libs:
>>> package: sys-devel/gcc-4.2.4
 *  - /usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libgcc_s.so
 *  - /usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libstdc++.so
 *  - /usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libstdc++.so.6
 *  - /usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libgcc_s.so.1
Use emerge @preserved-rebuild to rebuild packages using these libraries
# emerge -ptv @preserved-rebuild
Traceback (most recent call last):
  File "/usr/bin/emerge", line 18, in <module>
    retval = _emerge.emerge_main()
  File "/usr/lib/portage/pym/_emerge/__init__.py", line 8866, in emerge_main
    if not setconfig.getSetAtoms(s):
  File "/usr/lib/portage/pym/portage/sets/__init__.py", line 103, in getSetAtoms
    myatoms = myset.getAtoms()
  File "/usr/lib/portage/pym/portage/sets/base.py", line 53, in getAtoms
    self._load()
  File "/usr/lib/portage/pym/portage/sets/base.py", line 48, in _load
    self.load()
  File "/usr/lib/portage/pym/portage/sets/libs.py", line 46, in load
    consumers.update(self.dbapi.linkmap.findConsumers(lib))
  File "/usr/lib/portage/pym/portage/dbapi/vartree.py", line 220, in findConsumers
    raise KeyError("%s not in object list" % obj)
KeyError: '/usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libstdc++.so.6.0.9 not in object list'
#
Comment 1 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2008-05-25 18:06:17 UTC
Created attachment 154277 [details]
/var/cache/edb/library_consumers
Comment 2 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2008-05-25 18:07:10 UTC
Created attachment 154279 [details]
/var/lib/portage/preserved_libs_registry
Comment 3 Marius Mauch (RETIRED) gentoo-dev 2008-05-28 21:32:43 UTC
Hmm, I wasn't able to reproduce the problem (using r10466), probably because the libs were (correctly) not preserved here. As >=pre6 doesn't generate/use the library_consumers file anymore it's unfortunately useless for debugging.

There are several questions here:
a) why are those libs preserved? (likely the root problem)
b) why is libstdc++.so.6.0.9 not preserved?
c) why is the searched library not registered in the internal dict, resulting in the KeyError?
d) why does it only happen on some systems? (you aren't the only one reporting it, but if the majority of users would be affected I'd expect more reports even though it's only affecting >=pre6)

c) is likely a direct result of b), but still worth to investigate.

Some informations that might help to answer these questions:
1) emerge -Opv ~sys-devel/gcc-4.2.4 ~sys-devel/gcc-4.2.3 (only the relevant lines, ignore the error message)
2) ls -l /usr/lib/gcc/*/*/libstdc++.so* /usr/lib/libstdc++.so*
3) equery files sys-devel/gcc | fgrep libstdc++
4) python -c 'from portage.util import getlibpaths; print getlibpaths()'
5) python -c 'import portage, pickle; l=portage.db["/"]["vartree"].dbapi.linkmap; l.rebuild(); pickle.dump(l, file("linkmap", "w"))' # and attach the resulting linkmap file (you probably have to compress it)
Comment 4 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2008-05-31 17:41:17 UTC
Some days ago I manually deleted preserved libraries. Today I downgraded sys-devel/gcc-4.2.4 to sys-devel/gcc-4.2.3 and I reproduced this problem again. I have Portage r10520.

!!! existing preserved libs:
>>> package: sys-devel/gcc-4.2.3
 *  - /usr/lib/gcc/i686-pc-linux-gnu/4.2.4/libgcc_s.so
 *  - /usr/lib/gcc/i686-pc-linux-gnu/4.2.4/libstdc++.so
 *  - /usr/lib/gcc/i686-pc-linux-gnu/4.2.4/libstdc++.so.6
 *  - /usr/lib/gcc/i686-pc-linux-gnu/4.2.4/libgcc_s.so.1
Use emerge @preserved-rebuild to rebuild packages using these libraries
# emerge -ptv @preserved-rebuild
Traceback (most recent call last):
  File "/usr/bin/emerge", line 18, in <module>
    retval = _emerge.emerge_main()
  File "/usr/lib/portage/pym/_emerge/__init__.py", line 9073, in emerge_main
    if not setconfig.getSetAtoms(s):
  File "/usr/lib/portage/pym/portage/sets/__init__.py", line 103, in getSetAtoms
    myatoms = myset.getAtoms()
  File "/usr/lib/portage/pym/portage/sets/base.py", line 53, in getAtoms
    self._load()
  File "/usr/lib/portage/pym/portage/sets/base.py", line 48, in _load
    self.load()
  File "/usr/lib/portage/pym/portage/sets/libs.py", line 46, in load
    consumers.update(self.dbapi.linkmap.findConsumers(lib))
  File "/usr/lib/portage/pym/portage/dbapi/vartree.py", line 220, in findConsumers
    raise KeyError("%s not in object list" % obj)
KeyError: '/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/libstdc++.so.6.0.9 not in object list'
# emerge -Opv ~sys-devel/gcc-4.2.4 ~sys-devel/gcc-4.2.3

These are the packages that would be merged, in order:

[ebuild     U ] sys-devel/gcc-4.2.4 [4.2.3] USE="doc mudflap nls openmp (-altivec) -bootstrap -build -fortran -gcj -gtk (-hardened) -ip28 -ip32r10k -libffi (-multilib) -multislot (-n32) (-n64) -nocxx -objc -objc++ -objc-gc -test -vanilla" 0 kB
[ebuild   R   ] sys-devel/gcc-4.2.3  USE="doc mudflap nls openmp (-altivec) -bootstrap -build -fortran -gcj -gtk (-hardened) -ip28 -ip32r10k -libffi (-multilib) -multislot (-n32) (-n64) -nocxx -objc -objc++ -objc-gc -test -vanilla" 0 kB
...
# LC_ALL=C ls -l /usr/lib/gcc/*/*/libstdc++.so* /usr/lib/libstdc++.so*
ls: cannot access /usr/lib/libstdc++.so*: No such file or directory
lrwxrwxrwx 1 0 0   18 2008-05-31-19-26-05 /usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libstdc++.so -> libstdc++.so.6.0.9*
lrwxrwxrwx 1 0 0   18 2008-05-31-19-26-09 /usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libstdc++.so.6 -> libstdc++.so.6.0.9*
-rwxr-xr-x 1 0 0 912K 2008-02-17-21-20-59 /usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libstdc++.so.6.0.9*
lrwxrwxrwx 1 0 0   18 2008-05-31-19-26-05 /usr/lib/gcc/i686-pc-linux-gnu/4.2.4/libstdc++.so -> libstdc++.so.6.0.9*
lrwxrwxrwx 1 0 0   18 2008-05-31-19-26-05 /usr/lib/gcc/i686-pc-linux-gnu/4.2.4/libstdc++.so.6 -> libstdc++.so.6.0.9*
-rwxr-xr-x 1 0 0 908K 2008-05-25-19-10-33 /usr/lib/gcc/i686-pc-linux-gnu/4.2.4/libstdc++.so.6.0.9*
lrwxrwxrwx 1 0 0   19 2008-03-21-17-12-43 /usr/lib/gcc/i686-pc-linux-gnu/4.3.0/libstdc++.so -> libstdc++.so.6.0.10*
lrwxrwxrwx 1 0 0   19 2008-03-21-17-12-43 /usr/lib/gcc/i686-pc-linux-gnu/4.3.0/libstdc++.so.6 -> libstdc++.so.6.0.10*
-rwxr-xr-x 1 0 0 921K 2008-03-21-17-10-53 /usr/lib/gcc/i686-pc-linux-gnu/4.3.0/libstdc++.so.6.0.10*
# equery files sys-devel/gcc | fgrep libstdc++
/usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libstdc++.a
/usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libstdc++.so
/usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libstdc++.so.6
/usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libstdc++.so.6.0.9
/usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libstdc++_pic.a
/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/libstdc++.so
/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/libstdc++.so.6
/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/libstdc++.so.6.0.9
/usr/share/gcc-data/i686-pc-linux-gnu/4.2.3/locale/de/LC_MESSAGES/libstdc++.mo
/usr/share/gcc-data/i686-pc-linux-gnu/4.2.3/locale/fr/LC_MESSAGES/libstdc++.mo
/usr/lib/gcc/i686-pc-linux-gnu/4.3.0/libstdc++.a
/usr/lib/gcc/i686-pc-linux-gnu/4.3.0/libstdc++.so
/usr/lib/gcc/i686-pc-linux-gnu/4.3.0/libstdc++.so.6
/usr/lib/gcc/i686-pc-linux-gnu/4.3.0/libstdc++.so.6.0.10
/usr/lib/gcc/i686-pc-linux-gnu/4.3.0/libstdc++_pic.a
/usr/share/gcc-data/i686-pc-linux-gnu/4.3.0/locale/de/LC_MESSAGES/libstdc++.mo
/usr/share/gcc-data/i686-pc-linux-gnu/4.3.0/locale/fr/LC_MESSAGES/libstdc++.mo
# python -c 'from portage.util import getlibpaths; print getlibpaths()'
['/usr/local/lib', '/usr/lib/opengl/nvidia/lib', '/usr/i686-pc-linux-gnu/lib', '/usr/lib/gcc/i686-pc-linux-gnu/4.2.3', '/usr/lib/gcc/i686-pc-linux-gnu/4.3.0', '/usr/lib/nspr', '/usr/lib/nss', '/usr/lib/qca1', '/usr/lib/qca2', '/usr/lib/qt4', '/usr/kde/3.5/lib', '/usr/qt/3/lib', '/usr/games/lib', '/usr/lib/fltk-1.1', '/usr/lib/libstdc++-v3', '/usr/lib', '/lib']
# 
Comment 5 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2008-05-31 17:43:59 UTC
Created attachment 154981 [details]
linkmap
Comment 6 Marius Mauch (RETIRED) gentoo-dev 2008-06-02 08:55:25 UTC
Not sure if that's the reason, but your linkmap seems to be screwed up as for some records the fields aren't in the right order (e.g. runpath and needed attributes are swapped). Might have happened if you merged packages while the code was new and the format wasn't finalized (this would not affect people that only used releases though).
Please remove all NEEDED.ELF.2 files from /var/db/pkg and regenerate them with the code from the pre7 ebuild.
Comment 7 Marius Mauch (RETIRED) gentoo-dev 2008-06-02 09:17:30 UTC
Actually, do not use the code in the pre7 ebuild, the scanelf call contains another bug that corrupts certain library names (like libstdc++).
Comment 8 Marius Mauch (RETIRED) gentoo-dev 2008-06-02 10:36:37 UTC
Just committed a pre7-r1 ebuild that contains several fixes in the conversion code, please use that to rebuild all NEEDED.ELF.2 files.
Comment 9 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2008-06-07 22:01:28 UTC
Created attachment 155873 [details]
linkmap
Comment 10 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2008-06-07 22:08:43 UTC
I regenerated all NEEDED.ELF.2 files.

I reproduced this bug with app-text/poppler.
I upgraded app-text/poppler-0.6.3 to app-text/poppler-0.8.3.
I have Portage r10590.

# emerge -ptv @preserved-rebuild
Traceback (most recent call last):
  File "/usr/bin/emerge", line 18, in <module>
    retval = _emerge.emerge_main()
  File "/usr/lib/portage/pym/_emerge/__init__.py", line 9120, in emerge_main
    if not setconfig.getSetAtoms(s):
  File "/usr/lib/portage/pym/portage/sets/__init__.py", line 103, in getSetAtoms
    myatoms = myset.getAtoms()
  File "/usr/lib/portage/pym/portage/sets/base.py", line 53, in getAtoms
    self._load()
  File "/usr/lib/portage/pym/portage/sets/base.py", line 48, in _load
    self.load()
  File "/usr/lib/portage/pym/portage/sets/libs.py", line 46, in load
    consumers.update(self.dbapi.linkmap.findConsumers(lib))
  File "/usr/lib/portage/pym/portage/dbapi/vartree.py", line 220, in findConsumers
    raise KeyError("%s not in object list" % obj)
KeyError: '/usr/lib/libpoppler.so.2.0.0 not in object list'
# portageq list_preserved_libs /
app-text/poppler-0.8.3 /usr/lib/libpoppler.so.2
# emerge -Opv ~app-text/poppler-0.6.3 ~app-text/poppler-0.8.3

These are the packages that would be merged, in order:

[ebuild     UD] app-text/poppler-0.6.3 [0.8.3] USE="jpeg zlib -cjk" 0 kB
[ebuild   R   ] app-text/poppler-0.8.3  USE="jpeg zlib -cjk" 0 kB

Total: 2 packages (1 downgrade, 1 reinstall), Size of downloads: 0 kB
...
# ls -l /usr/lib/libpoppler.so*
lrwxrwxrwx 1 0 0   19 2008-06-07-22-56-53 /usr/lib/libpoppler.so -> libpoppler.so.3.0.0*
lrwxrwxrwx 1 0 0   19 2008-06-07-22-55-55 /usr/lib/libpoppler.so.2 -> libpoppler.so.2.0.0*
-rwxr-xr-x 1 0 0 1,6M 2008-01-24-20-01-22 /usr/lib/libpoppler.so.2.0.0*
lrwxrwxrwx 1 0 0   19 2008-06-07-22-56-53 /usr/lib/libpoppler.so.3 -> libpoppler.so.3.0.0*
-rwxr-xr-x 1 0 0 1,7M 2008-06-07-22-55-40 /usr/lib/libpoppler.so.3.0.0*
# equery files poppler | fgrep libpoppler
/usr/lib/libpoppler.a
/usr/lib/libpoppler.la
/usr/lib/libpoppler.so
/usr/lib/libpoppler.so.2
/usr/lib/libpoppler.so.2.0.0
/usr/lib/libpoppler.so.3
/usr/lib/libpoppler.so.3.0.0
# python -c 'from portage.util import getlibpaths; print getlibpaths()'
['/usr/local/lib', '/usr/lib/opengl/nvidia/lib', '/usr/i686-pc-linux-gnu/lib', '/usr/lib/gcc/i686-pc-linux-gnu/4.2.4', '/usr/lib/gcc/i686-pc-linux-gnu/4.3.0', '/usr/lib/nspr', '/usr/lib/nss', '/usr/lib/qca1', '/usr/lib/qca2', '/usr/lib/qt4', '/usr/kde/3.5/lib', '/usr/qt/3/lib', '/usr/games/lib', '/usr/lib/fltk-1.1', '/usr/lib/libstdc++-v3', '/usr/lib', '/lib']
# 
Comment 11 Marius Mauch (RETIRED) gentoo-dev 2008-06-08 13:36:44 UTC
Created attachment 155935 [details, diff]
Patch to correct the scanelf call for preserved libs

Please test with this patch and report back if it fixes the problem for you (esp. the gcc issue if you can reproduce it/haven't manually fixed it)
Comment 12 Marius Mauch (RETIRED) gentoo-dev 2008-06-08 13:57:38 UTC
Created attachment 155943 [details, diff]
Patch to correct scanelf call and symlink preservation issue

This patch fixes another bug related to registration of preserved libs
Comment 13 Thomas R. (TRauMa) 2008-06-09 13:50:22 UTC
Just some feedback:
I installed 2.2_pre7-r1 on an old system (mainly so I don't have to resolve the many blockers of the last half year manually) and I had both bug #220671 and after solving it with the patch provided there, this keyerror (which *is* solved by the patch provided here), both while emerging gcrypt.
Comment 14 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2008-06-10 16:04:12 UTC
Needless preservation of sys-devel/gcc libraries moved to Bug #225429.