What magic does portage use?
On Friday 11 December 2009 11:11:41 Helmut Jarausch wrote:
> I'm curious how portage solves its most difficult part (in my eyes).
> When installing a dynamic library (by "hand") I have often got an
> error messages if the corresponding library is currently in use.
> How does portage succeed anyway.
> (I have the suspicion that it does not succeed always, since sometimes
> only rebooting solves some very strange problems)
> How to replace fundamental X11-libaries on a system running X11
> or even more suprising, how can I replace a running glibc ?
> Many thanks for enlightening me,
Portage does nothing special, as dealing with this is a Unix thing.
On Unix, the inode is the file, not the directory entry. If you want to
replace an open file, the system simply does it and updates the dentry to
point to a new inode. Any spp using the old file will continue to use it as it
still has a handle to the inode. The inode is only fully deleted when the last
app using it closes it
If you update a library to a new version with an API break, the lib should get
a new soname so the file is a different name, hence no collision (symlinks to
This is how it should work, any code that tries to do it a different way is by
definition broken, that's why portage needs take no special measures.
All of this is in complete contrast to other broken systems, such as Windows
for example. On Windows, the filename IS the file, so upgrades are horrible.
Installers must put the file somewhere else and have the final steps and
registry updates done at next reboot before anything has a chance to open
libs. This is why fairly deep updates on Windows often require multiple reboot
- multiple apps installed multiple libs to be fiddled with multiple times ....
alan dot mckinnon at gmail dot com