3 ms·
Yes. In many cases, switching to the new version of the package is nothing more than rewriting a symlink. Sometimes it's more involved, like restarting a servic
by cwp 11y ago
Yes. In many cases, switching to the new version of the package is nothing more than rewriting a symlink. Sometimes it's more involved, like restarting a service. Either way, the cut over happens after building the new package has completed successfully. If building the package fails, it has no effect on the running system.
I suppose there is still a window in which an error could leave the system in an inconsistent state, but it's pretty narrow, and the error would have to be a kernel panic or something like that.
- millstone 11y agoErr, are there any systems that try to cut over to a new package before it's been built successfully?
- thrownaway122 11y agoI guess that traditional package managers could install a helper script or a config file early in the build system before the main package is finished.
- cwp 11y agoYes. Almost all of them, actually. By "build" I mean the whole package installation process, including moving the compiled files into their final destinations. If you're upgrading an existing package, and that involves overwriting one binary in /usr/bin and another in /usr/lib, a crash in the middle of that process leaves the package partially upgraded, and very likely broken. Nix never overwrites an existing package installation. Instead, it installs the new version in a separate directory, then overwrites a symlink that pointed to the old version with a symlink pointing to the new version.