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
parent
5ff521452b
commit
bfe4cdf88e
|
@ -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) {
|
||||
|
||||
|
|
Reference in New Issue