passAsFile: leave out the hash prefix
Having a colon in the path may cause issues, and having the hash function indicated isn't actually necessary. We now verify the path format in the tests to prevent regressions.
This commit is contained in:
@@ -2460,7 +2460,7 @@ void DerivationGoal::initTmpDir() {
|
||||
env[i.first] = i.second;
|
||||
} else {
|
||||
auto hash = hashString(htSHA256, i.first);
|
||||
string fn = ".attr-" + hash.to_string();
|
||||
string fn = ".attr-" + hash.to_string(Base32, false);
|
||||
Path p = tmpDir + "/" + fn;
|
||||
writeFile(p, i.second);
|
||||
chownToBuilder(p);
|
||||
|
||||
@@ -10,6 +10,7 @@ mkDerivation {
|
||||
passAsFile = [ \"foo\" ];
|
||||
foo = [ \"xyzzy\" ];
|
||||
builder = builtins.toFile \"builder.sh\" ''
|
||||
[ \"\$(basename \$fooPath)\" = .attr-1bp7cri8hplaz6hbz0v4f0nl44rl84q1sg25kgwqzipzd1mv89ic ]
|
||||
[ \"\$(cat \$fooPath)\" = xyzzy ]
|
||||
touch \$out
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user