aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2020-01-04 20:23:59 +0100
committerDaiderd Jordan <daiderd@gmail.com>2020-01-04 20:25:25 +0100
commit7d448bc966021e63e9c7b96530cee885f3dcd68d (patch)
tree8bd063de95c0c97286d0c5fecc2115d8e84a2f17
parentb33fefcb92e02725fc77b6adfabab1c1f43e9aa1 (diff)
build: fix path repairing when hash rewriting is required
Handle store path repairing on darwin when sandboxing is enabled. Unlike on linux sandboxing on darwin still requires hash rewriting.
-rw-r--r--src/libstore/build.cc24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 257d70ca9..0674f936b 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -3567,19 +3567,6 @@ void DerivationGoal::registerOutputs()
if (!missingPaths.count(i.second.path)) continue;
Path actualPath = path;
- if (useChroot) {
- actualPath = chrootRootDir + path;
- if (pathExists(actualPath)) {
- /* Move output paths from the chroot to the Nix store. */
- if (buildMode == bmRepair)
- replaceValidPath(path, actualPath);
- else
- if (buildMode != bmCheck && rename(actualPath.c_str(), worker.store.toRealPath(path).c_str()) == -1)
- throw SysError(format("moving build output '%1%' from the sandbox to the Nix store") % path);
- }
- if (buildMode != bmCheck) actualPath = worker.store.toRealPath(path);
- }
-
if (needsHashRewrite()) {
auto r = redirectedOutputs.find(i.second.path);
if (r != redirectedOutputs.end()) {
@@ -3591,6 +3578,17 @@ void DerivationGoal::registerOutputs()
if (buildMode == bmCheck)
actualPath = redirected;
}
+ } else if (useChroot) {
+ actualPath = chrootRootDir + path;
+ if (pathExists(actualPath)) {
+ /* Move output paths from the chroot to the Nix store. */
+ if (buildMode == bmRepair)
+ replaceValidPath(path, actualPath);
+ else
+ if (buildMode != bmCheck && rename(actualPath.c_str(), worker.store.toRealPath(path).c_str()) == -1)
+ throw SysError(format("moving build output '%1%' from the sandbox to the Nix store") % path);
+ }
+ if (buildMode != bmCheck) actualPath = worker.store.toRealPath(path);
}
struct stat st;