diff options
author | Kevin Amado <kamadorueda@gmail.com> | 2021-10-15 21:03:01 -0500 |
---|---|---|
committer | Kevin Amado <kamadorueda@gmail.com> | 2021-10-17 12:54:53 -0500 |
commit | 823dce945a702c9ae51a83098f78e55ed780a223 (patch) | |
tree | 48930a95895c55d4e954bd9c901bef4c31d1f56f | |
parent | 97b49041363b4689d3faf7b7bb4e2f64bd7b0584 (diff) |
fetch: nicer infinite recursion errors
- This change applies to builtins.fetchurl and builtins.fetchTarball
- PoC: `let x = builtins.fetchurl x; in x`
- Before:
```bash
$ nix-instantiate --extra-experimental-features flakes --strict
error: infinite recursion encountered
```
- After:
```bash
$ nix-instantiate --extra-experimental-features flakes --strict
error: infinite recursion encountered
at /data/github/kamadorueda/nix/test.nix:1:9:
1| let x = builtins.fetchurl x; in x
| ^
```
Mentions: #3505
-rw-r--r-- | src/libexpr/primops/fetchTree.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libexpr/primops/fetchTree.cc b/src/libexpr/primops/fetchTree.cc index 727b661e1..b00a79b7f 100644 --- a/src/libexpr/primops/fetchTree.cc +++ b/src/libexpr/primops/fetchTree.cc @@ -189,7 +189,7 @@ static void fetch(EvalState & state, const Pos & pos, Value * * args, Value & v, std::optional<std::string> url; std::optional<Hash> expectedHash; - state.forceValue(*args[0]); + state.forceValue(*args[0], pos); if (args[0]->type() == nAttrs) { |