about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-12-29T14·28+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-12-29T14·28+0100
commitb8258a4475726b56a4caa6553568c67a343a091d (patch)
tree4fbbc7dc1f871859ce7ab6a03a8747e6138b583d
parent52120123a5505199c342afb42f1a48b9cb2628ed (diff)
Fix regression in passAsFile
Caused by 8063fc497ab78fa72962b93874fe25dcca2b55ed. If tmpDir !=
tmpDirInSandbox (typically when there are multiple concurrent builds
with the same name), the *Path attribute would not point to an
existing file. This caused Nixpkgs' writeTextFile to write an empty
file. In particular this showed up as hanging VM builds (because it
would run an empty run-nixos-vm script and then wait for it to finish
booting).
-rw-r--r--src/libstore/build.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 0fd958846440..e00a07d3b1a0 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1778,10 +1778,11 @@ void DerivationGoal::startBuilder()
         if (passAsFile.find(i.first) == passAsFile.end()) {
             env[i.first] = i.second;
         } else {
-            Path p = tmpDir + "/.attr-" + std::to_string(fileNr++);
+            string fn = ".attr-" + std::to_string(fileNr++);
+            Path p = tmpDir + "/" + fn;
             writeFile(p, i.second);
             filesToChown.insert(p);
-            env[i.first + "Path"] = p;
+            env[i.first + "Path"] = tmpDirInSandbox + "/" + fn;
         }
     }