mirror of
https://github.com/NixOS/nix
synced 2025-07-07 10:11:47 +02:00
build: also throw hash-mismatch errors if buildMode == bmCheck
This actually bit me quite recently in `nixpkgs` because I assumed that `nix-build --check` would also error out if hashes don't match anymore[1] and so I wrongly assumed that I couldn't reproduce the mismatch error. The fix is rather simple, during the output registration a so-called `delayedException` is instantiated e.g. if a FOD hash-mismatch occurs. However, in case of `nix-build --check` (or `--rebuild` in case of `nix build`), the code-path where this exception is thrown will never be reached. By adding that check to the if-clause that causes an early exit in case of `bmCheck`, the issue is gone. Also added a (previously failing) test-case to demonstrate the problem. [1] https://github.com/NixOS/nixpkgs/pull/139238, the underlying issue was that `nix-prefetch-git` returns different hashes than `fetchgit` because the latter one fetches submodules by default.
This commit is contained in:
parent
a0bb5c4130
commit
bb1a851bcf
3 changed files with 20 additions and 1 deletions
|
@ -15,6 +15,11 @@ nix path-info --json $path | grep fixed:md5:2qk15sxzzjlnpjk9brn7j8ppcd
|
|||
echo 'testing good...'
|
||||
nix-build fixed.nix -A good --no-out-link
|
||||
|
||||
if isDaemonNewer "2.4pre20210927"; then
|
||||
echo 'testing --check...'
|
||||
nix-build fixed.nix -A check --check && fail "should fail"
|
||||
fi
|
||||
|
||||
echo 'testing good2...'
|
||||
nix-build fixed.nix -A good2 --no-out-link
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue