aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-01-03 00:08:23 +0100
committerGitHub <noreply@github.com>2020-01-03 00:08:23 +0100
commit3ad4a332eb704a4b6f2644cefbcfc5f406b39ca4 (patch)
tree3a1c2d1792dfc4e058667347c89398701d49a956 /src
parent3469062e7638b07a2ff10638c58a78499f11b2a9 (diff)
parent515c0a263e137a00e82f7d981284dbe54db23247 (diff)
Merge pull request #3297 from edef1c/passasfile-hash
passAsFile: hash the attribute name instead of numbering sequentially
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 5d681d279..9ee3b04e3 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -2455,12 +2455,12 @@ void DerivationGoal::initTmpDir() {
if (!parsedDrv->getStructuredAttrs()) {
StringSet passAsFile = tokenizeString<StringSet>(get(drv->env, "passAsFile").value_or(""));
- int fileNr = 0;
for (auto & i : drv->env) {
if (passAsFile.find(i.first) == passAsFile.end()) {
env[i.first] = i.second;
} else {
- string fn = ".attr-" + std::to_string(fileNr++);
+ auto hash = hashString(htSHA256, i.first);
+ string fn = ".attr-" + hash.to_string();
Path p = tmpDir + "/" + fn;
writeFile(p, i.second);
chownToBuilder(p);