mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
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.
This commit is contained in:
parent
5ff521452b
commit
bfe4cdf88e
1 changed files with 19 additions and 18 deletions
|
@ -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) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue