I triggered this issue by unmerging app-text/editorconfig-core-c-0.12.1, removing the resulting preserved libraries manually, and then re-merging the package. Afterwards, the libraries showed as preserved even though I had just re-merged the package:
!!! existing preserved libs:
>>> package: app-text/editorconfig-core-c-0.12.1
* - /usr/lib64/libeditorconfig.so.0
* - /usr/lib64/libeditorconfig.so.0.12.1
* used by /usr/lib64/geany/editorconfig-geany.so (dev-util/editorconfig-geany-0.1_p20160725)
The issue is triggered in part because PreservedLibsRegistry.pruneNonExisting is convinced that the newly merged libraries are the preserved libraries, even though the preserved libraries had been manually removed.
Since the manually removed libraries do not exist on disk prior to merge, they don't show up in the plib_collisions dictionary here:
It seems like the easiest fix would be to intersect files in the PreservedLibsRegistry with the files installed by the current package, and add those files to the plib_collisions dictionary.
(In reply to Zac Medico from comment #1)
> It seems like the easiest fix would be to intersect files in the
> PreservedLibsRegistry with the files installed by the current package, and
> add those files to the plib_collisions dictionary.
That won't work, because at this point there's no way to distinguish files that have been legitimately installed from those that were already preserved. So, we'll have to write the pruned preserve-libs registry to disk prior to merge.
I've posted a patch for review:
This is in the master branch:
Fixed in portage-2.3.3.