Skip to content

Commit

Permalink
Don't crash if we can't rename the paths out of the sandbox
Browse files Browse the repository at this point in the history
For some reason (probably linked to
https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html?highlight=overlayfs#renaming-directories),
renaming the output paths of a derivation from their sandbox location
(`/nix/store/abc-foo.drv.chroot/nix/store/def-foo`) to their final one
(`/nix/store/def-foo`) fails in some scenarios with `EXDEV` (“invalid
cross-device link”).

Work around that by falling back to copying them in that case, which is
much less efficient, but correct.

Fix NixOS#8395
  • Loading branch information
Théophane Hufschmitt committed May 25, 2023
1 parent 6e45702 commit 3ec2227
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libstore/build/local-derivation-goal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ bool LocalDerivationGoal::cleanupDecideWhetherDiskFull()
if (buildMode != bmCheck && status.known->isValid()) continue;
auto p = worker.store.printStorePath(status.known->path);
if (pathExists(chrootRootDir + p))
renameFile((chrootRootDir + p), p);
moveFile((chrootRootDir + p), p);
}

return diskFull;
Expand Down

0 comments on commit 3ec2227

Please sign in to comment.