Although most of the software in Portage already follows the correct rule of not putting their plugins in
/usr/lib or equivalent directories, during my collision detection analysis I did find a few that instead pollute the standard library path with their plugins.
In general, I see way too much pollution in the library path, and that is quite bad since the loader will have to iterate through all of it whenever it has to find a library that is not in the cache, or if environment variables are set that forces it to look for libraries in a different order. Also, the linker (which is quite slow already) needs to look there to find the libraries to link to, which means more and more work every time, to scan everything.
For this reason, the amount of files in
/usr/lib that are not needed to be there should really be reduced drastically, this means for instance not installing shell scripts there, like quite a bit of software does, and especially not installing plugins, since those would be picked up by the
ldconfig utility and written in a cachefile that should really be as small as possible.
It’s not just that though, there are more problems with software installing plugins, for instance I noticed that in the PAM modules directory
/lib/security there is one plugin with a full-versioned name (that is with the final
.0.0 which is not needed by PAM modules) and another that uses the lib prefix (also unneeded); both are likely built with libtool by somebody who knows not how to properly build plugins.
I really should be writing another further test to make sure that the packages get installed following the usual layout, I just don’t know how for now. It would be a nice way to identify “rogue” packages that install outside of the standard-defined directories.
In general, whenever you want to install plugins you should do so by putting them in a separate directory inside
pkglibdir when using automake (defaults to
/usr/lib/PACKAGE_NAME). This also allows a much simpler approach to plugins loading. And if you’re not really allowing plug-ins to be added after the ones compiled at build time, then you should probably not use plugins but rather build them in.
I guess there is more work for my tinderbox now…