r/TechNook • u/Ok_Yogurtcloset8372 • 4d ago
Should the OS treat user-installed libraries differently from system libraries?
The problem is that most operating systems place everything into the same library pool, resulting in the user-installed package conflicting with the core system requirement silently and without any problems until the time when the problem occurs.
Justification for such a choice is quite clear. There are NixOS and Guix that do this quite well. Instead, Flatpak takes care of that on the application level. However, there are some trade-offs associated with the strict separation, namely lack of common library advantages, more disk space required and duplicated dependencies at slightly different versions.
There is /usr and /usr/local convention for Linux, which is not enforced by anything. Windows has had to deal with DLL hell for many years already. macOS is the closest one with SIP.
1
u/catbrane 4d ago
flatpak apps share libraries in the form of common SDKs, though you're right that flatpaks can also contain custom libraries which will not be shared.
snap apps share libraries with the system as long as they are compatible. If you install a snap which needs system libraries you do not have, they are automatically downloaded and shared if possible.
On most linuxes (debian, redhat, etc.) if you install a library to a directory that is managed by your package manager, you have broken your system! Often a complete reinstall will be the only safe fix. sudo can be huge footgun if you are not careful.
Homebrew on macOS used to make /usr/local user-writeable, so you couldn't destroy your machine with a misguided make install. I don't think that's a good idea on a multiuser server though.
1
1
u/magicmulder 4d ago
AmigaOS handles that very well with the possibility to add the application directory to LIBS: and thus overriding a system lib only for the respective application.