From 1a21b4cdb404c7b9409278402468a3487c8012cf Mon Sep 17 00:00:00 2001 From: Felix Uhl Date: Sun, 15 Jan 2023 15:42:24 +0100 Subject: [PATCH] Don't overwrite already-copied files on install Fixes #6679 and all issues that contain `cp: cannot overwrite directory ... with non-directory` errors. These were caused by 475fc109e72e494039b253131314e3a3ea5723c6 and bb0c4b9f25b6d064d91aedd71940f14b1b624291. Or rather, installations after 475fc109 erroneously followed and deep-copied symlinks, which was fixed in bb0c4b9f. This meant installations installed with the installer released between these commits had some paths in their nix store with directories where symlinks should have been, causing the fixed installer to try to overwrite them with symlinks. The -n will not overwrite existing files, which is fine inside of the nix-store as identical store paths will have identical content. For additional details and examples, see https://github.com/NixOS/nix/pull/7603#issuecomment-1411124619 --- scripts/install-multi-user.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-multi-user.sh b/scripts/install-multi-user.sh index 656769d84d4..474df5826c4 100644 --- a/scripts/install-multi-user.sh +++ b/scripts/install-multi-user.sh @@ -816,7 +816,7 @@ install_from_extracted_nix() { cd "$EXTRACTED_NIX_PATH" _sudo "to copy the basic Nix files to the new store at $NIX_ROOT/store" \ - cp -RPp ./store/* "$NIX_ROOT/store/" + cp -RPnp ./store/* "$NIX_ROOT/store/" _sudo "to make the new store non-writable at $NIX_ROOT/store" \ chmod -R ugo-w "$NIX_ROOT/store/"