mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
Merge pull request #5654 from NixOS/pure-file-access-error-message
Fix the error when accessing a forbidden path in pure eval
This commit is contained in:
commit
1d2dbbb977
2 changed files with 10 additions and 3 deletions
|
@ -519,8 +519,12 @@ Path EvalState::checkSourcePath(const Path & path_)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found) {
|
||||||
throw RestrictedPathError("access to absolute path '%1%' is forbidden in restricted mode", abspath);
|
auto modeInformation = evalSettings.pureEval
|
||||||
|
? "in pure eval mode (use '--impure' to override)"
|
||||||
|
: "in restricted mode";
|
||||||
|
throw RestrictedPathError("access to absolute path '%1%' is forbidden %2%", abspath, modeInformation);
|
||||||
|
}
|
||||||
|
|
||||||
/* Resolve symlinks. */
|
/* Resolve symlinks. */
|
||||||
debug(format("checking access to '%s'") % abspath);
|
debug(format("checking access to '%s'") % abspath);
|
||||||
|
|
|
@ -6,7 +6,10 @@ nix eval --expr 'assert 1 + 2 == 3; true'
|
||||||
|
|
||||||
[[ $(nix eval --impure --expr 'builtins.readFile ./pure-eval.sh') =~ clearStore ]]
|
[[ $(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.currentTime)
|
||||||
(! nix eval --expr builtins.currentSystem)
|
(! nix eval --expr builtins.currentSystem)
|
||||||
|
|
Loading…
Reference in a new issue