Fix regression in passAsFile

Caused by 8063fc497a. 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).
This commit is contained in:
Eelco Dolstra 2015-12-29 15:28:20 +01:00
parent 52120123a5
commit b8258a4475

View file

@ -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;
}
}