me
/
guix
Archived
1
0
Fork 0

daemon: Raise an error if substituter doesn't send the expected hash.

It was already impossible in practice for 'expectedHashStr' to be empty
if 'status' == "success".

* nix/libstore/build.cc (SubstitutionGoal::finished): Throw 'SubstError'
when 'expectedHashStr' is empty.
master
Ludovic Courtès 2020-12-03 09:44:22 +01:00
parent 5ff521452b
commit bfe4cdf88e
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 19 additions and 18 deletions

View File

@ -3040,10 +3040,12 @@ void SubstitutionGoal::finished()
if (!pathExists(destPath))
throw SubstError(format("substitute did not produce path `%1%'") % destPath);
if (expectedHashStr == "")
throw SubstError(format("substituter did not communicate hash for `%1'") % storePath);
hash = hashPath(htSHA256, destPath);
/* Verify the expected hash we got from the substituer. */
if (expectedHashStr != "") {
size_t n = expectedHashStr.find(':');
if (n == string::npos)
throw Error(format("bad hash from substituter: %1%") % expectedHashStr);
@ -3060,7 +3062,6 @@ void SubstitutionGoal::finished()
% printHash16or32(actualHash));
throw SubstError(format("hash mismatch for substituted item `%1%'") % storePath);
}
}
} catch (SubstError & e) {