mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 06:52:43 +01:00
EvalState::mountInput(): Throw an error if there is a NAR hash mismatch
This commit is contained in:
parent
630bdff7e9
commit
91cde8c79d
2 changed files with 12 additions and 5 deletions
|
|
@ -83,8 +83,16 @@ StorePath EvalState::mountInput(
|
|||
}
|
||||
|
||||
// FIXME: what to do with the NAR hash in lazy mode?
|
||||
if (!settings.lazyTrees)
|
||||
assert(!originalInput.getNarHash() || storePath == originalInput.computeStorePath(*store));
|
||||
if (!settings.lazyTrees && originalInput.getNarHash()) {
|
||||
auto expected = originalInput.computeStorePath(*store);
|
||||
if (storePath != expected)
|
||||
throw Error(
|
||||
(unsigned int) 102,
|
||||
"NAR hash mismatch in input '%s', expected '%s' but got '%s'",
|
||||
originalInput.to_string(),
|
||||
store->printStorePath(storePath),
|
||||
store->printStorePath(expected));
|
||||
}
|
||||
|
||||
return storePath;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue