mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
Merge pull request #12701 from mightyiam/nix-infrec-base-error
stack overflow is EvalBaseError
This commit is contained in:
commit
2172c17b5e
2 changed files with 12 additions and 1 deletions
|
@ -146,7 +146,7 @@ inline void EvalState::forceList(Value & v, const PosIdx pos, std::string_view e
|
||||||
[[gnu::always_inline]]
|
[[gnu::always_inline]]
|
||||||
inline CallDepth EvalState::addCallDepth(const PosIdx pos) {
|
inline CallDepth EvalState::addCallDepth(const PosIdx pos) {
|
||||||
if (callDepth > settings.maxCallDepth)
|
if (callDepth > settings.maxCallDepth)
|
||||||
error<EvalError>("stack overflow; max-call-depth exceeded").atPos(pos).debugThrow();
|
error<EvalBaseError>("stack overflow; max-call-depth exceeded").atPos(pos).debugThrow();
|
||||||
|
|
||||||
return CallDepth(callDepth);
|
return CallDepth(callDepth);
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,6 +22,11 @@ cat >"$flake1Dir/flake.nix" <<EOF
|
||||||
echo true > \$out
|
echo true > \$out
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
stack-depth =
|
||||||
|
let
|
||||||
|
f = x: if x == 0 then true else f (x - 1);
|
||||||
|
in
|
||||||
|
assert (f 100); self.drv;
|
||||||
ifd = assert (import self.drv); self.drv;
|
ifd = assert (import self.drv); self.drv;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -33,6 +38,12 @@ git -C "$flake1Dir" commit -m "Init"
|
||||||
expect 1 nix build "$flake1Dir#foo.bar" 2>&1 | grepQuiet 'error: breaks'
|
expect 1 nix build "$flake1Dir#foo.bar" 2>&1 | grepQuiet 'error: breaks'
|
||||||
expect 1 nix build "$flake1Dir#foo.bar" 2>&1 | grepQuiet 'error: breaks'
|
expect 1 nix build "$flake1Dir#foo.bar" 2>&1 | grepQuiet 'error: breaks'
|
||||||
|
|
||||||
|
# Stack overflow error must not be cached
|
||||||
|
expect 1 nix build --max-call-depth 50 "$flake1Dir#stack-depth" 2>&1 \
|
||||||
|
| grepQuiet 'error: stack overflow; max-call-depth exceeded'
|
||||||
|
# If the SO is cached, the following invocation will produce a cached failure; we expect it to succeed
|
||||||
|
nix build --no-link "$flake1Dir#stack-depth"
|
||||||
|
|
||||||
# Conditional error should not be cached
|
# Conditional error should not be cached
|
||||||
expect 1 nix build "$flake1Dir#ifd" --option allow-import-from-derivation false 2>&1 \
|
expect 1 nix build "$flake1Dir#ifd" --option allow-import-from-derivation false 2>&1 \
|
||||||
| grepQuiet 'error: cannot build .* during evaluation because the option '\''allow-import-from-derivation'\'' is disabled'
|
| grepQuiet 'error: cannot build .* during evaluation because the option '\''allow-import-from-derivation'\'' is disabled'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue