about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2019-05-12T13·53+0200
committerDaiderd Jordan <daiderd@gmail.com>2019-05-12T13·53+0200
commitff6867ab94cbe9ddcb4ba18d68a4a2dcb79b865d (patch)
treef25265457cc8031fa3a55d4a8e8e185fa1c9a7f9
parent7c6391ddc730519a632cc0ee526c94a04812d871 (diff)
build: move needsHashRewrite initialization to startBuilder
The value of useChroot is not set yet in the constructor, resulting in
hash rewriting being enabled in certain cases where it should not be.

Fixes #2801
-rw-r--r--src/libstore/build.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 91eb97dfb873..30825add43bf 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -997,13 +997,6 @@ DerivationGoal::DerivationGoal(const Path & drvPath, const StringSet & wantedOut
     , wantedOutputs(wantedOutputs)
     , buildMode(buildMode)
 {
-#if __linux__
-    needsHashRewrite = !useChroot;
-#else
-    /* Darwin requires hash rewriting even when sandboxing is enabled. */
-    needsHashRewrite = true;
-#endif
-
     state = &DerivationGoal::getDerivation;
     name = (format("building of '%1%'") % drvPath).str();
     trace("created");
@@ -1852,6 +1845,13 @@ void DerivationGoal::startBuilder()
         #endif
     }
 
+#if __linux__
+    needsHashRewrite = !useChroot;
+#else
+    /* Darwin requires hash rewriting even when sandboxing is enabled. */
+    needsHashRewrite = true;
+#endif
+
     /* If `build-users-group' is not empty, then we have to build as
        one of the members of that group. */
     if (settings.buildUsersGroup != "" && getuid() == 0) {