Merge pull request #3298 from edef1c/passasfile-noprefix

passAsFile: leave out the hash prefix
This commit is contained in:
Eelco Dolstra 2020-01-03 12:43:06 +01:00 committed by GitHub
commit 0de33cc81b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -2460,7 +2460,7 @@ void DerivationGoal::initTmpDir() {
env[i.first] = i.second; env[i.first] = i.second;
} else { } else {
auto hash = hashString(htSHA256, i.first); auto hash = hashString(htSHA256, i.first);
string fn = ".attr-" + hash.to_string(); string fn = ".attr-" + hash.to_string(Base32, false);
Path p = tmpDir + "/" + fn; Path p = tmpDir + "/" + fn;
writeFile(p, i.second); writeFile(p, i.second);
chownToBuilder(p); chownToBuilder(p);

View file

@ -10,6 +10,7 @@ mkDerivation {
passAsFile = [ \"foo\" ]; passAsFile = [ \"foo\" ];
foo = [ \"xyzzy\" ]; foo = [ \"xyzzy\" ];
builder = builtins.toFile \"builder.sh\" '' builder = builtins.toFile \"builder.sh\" ''
[ \"\$(basename \$fooPath)\" = .attr-1bp7cri8hplaz6hbz0v4f0nl44rl84q1sg25kgwqzipzd1mv89ic ]
[ \"\$(cat \$fooPath)\" = xyzzy ] [ \"\$(cat \$fooPath)\" = xyzzy ]
touch \$out touch \$out
''; '';