diff options
author | Puck Meerburg <puck@puck.moe> | 2020-01-02T17·20+0000 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-31T18·18+0100 |
commit | 7cc7fdacbe166878079d583b5c337967742a6276 (patch) | |
tree | 4ed30728a95e6bdca0ea00b827a1ee0407f4b43d | |
parent | 976b49f2ed99da67e596ebb2eec3b8db672fc450 (diff) |
fix(3p/nix): passAsFile: hash the attribute name instead of numbering sequentially r/875
This makes the paths consistent without relying on ordering. Co-authored-by: edef <edef@edef.eu> (cherry picked from commit 515c0a263e137a00e82f7d981284dbe54db23247)
-rw-r--r-- | third_party/nix/src/libstore/build.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/third_party/nix/src/libstore/build.cc b/third_party/nix/src/libstore/build.cc index 0b4bce182031..e7a9ea45e6eb 100644 --- a/third_party/nix/src/libstore/build.cc +++ b/third_party/nix/src/libstore/build.cc @@ -2485,12 +2485,12 @@ void DerivationGoal::initTmpDir() { if (!parsedDrv->getStructuredAttrs()) { std::set<std::string> passAsFile = absl::StrSplit(get(drv->env, "passAsFile"), absl::ByAnyChar(" \t\n\r")); - int fileNr = 0; for (auto& i : drv->env) { if (passAsFile.find(i.first) == passAsFile.end()) { env[i.first] = i.second; } else { - std::string fn = ".attr-" + std::to_string(fileNr++); + auto hash = hashString(htSHA256, i.first); + std::string fn = ".attr-" + hash.to_string(); Path p = tmpDir + "/" + fn; writeFile(p, rewriteStrings(i.second, inputRewrites)); chownToBuilder(p); |