mirror of
https://github.com/NixOS/nix
synced 2025-06-30 07:33:16 +02:00
Fix the error when accessing a forbidden path in pure eval
If we’re in pure eval mode, then tell that in the error message rather than (wrongly) speaking about restricted mode. Fix https://github.com/NixOS/nix/issues/5611
This commit is contained in:
parent
1f7584d24c
commit
c47027f3a1
2 changed files with 10 additions and 3 deletions
|
@ -6,7 +6,10 @@ nix eval --expr 'assert 1 + 2 == 3; true'
|
|||
|
||||
[[ $(nix eval --impure --expr 'builtins.readFile ./pure-eval.sh') =~ clearStore ]]
|
||||
|
||||
(! nix eval --expr 'builtins.readFile ./pure-eval.sh')
|
||||
missingImpureErrorMsg=$(! nix eval --expr 'builtins.readFile ./pure-eval.sh' 2>&1)
|
||||
|
||||
echo "$missingImpureErrorMsg" | grep -q -- --impure || \
|
||||
fail "The error message should mention the “--impure” flag to unblock users"
|
||||
|
||||
(! nix eval --expr builtins.currentTime)
|
||||
(! nix eval --expr builtins.currentSystem)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue