mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
Merge pull request #6698 from tweag/forbid-tilde-paths-in-pure-mode
Forbid the tilde expansion in pure eval mode
This commit is contained in:
commit
f06b6fa4fa
2 changed files with 8 additions and 0 deletions
|
@ -520,6 +520,12 @@ path_start
|
||||||
$$ = new ExprPath(path);
|
$$ = new ExprPath(path);
|
||||||
}
|
}
|
||||||
| HPATH {
|
| HPATH {
|
||||||
|
if (evalSettings.pureEval) {
|
||||||
|
throw Error(
|
||||||
|
"the path '%s' can not be resolved in pure mode",
|
||||||
|
std::string_view($1.p, $1.l)
|
||||||
|
);
|
||||||
|
}
|
||||||
Path path(getHome() + std::string($1.p + 1, $1.l - 1));
|
Path path(getHome() + std::string($1.p + 1, $1.l - 1));
|
||||||
$$ = new ExprPath(path);
|
$$ = new ExprPath(path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,3 +30,5 @@ nix eval --store dummy:// --write-to $TEST_ROOT/eval-out --expr '{ x = "foo" + "
|
||||||
|
|
||||||
rm -rf $TEST_ROOT/eval-out
|
rm -rf $TEST_ROOT/eval-out
|
||||||
(! nix eval --store dummy:// --write-to $TEST_ROOT/eval-out --expr '{ "." = "bla"; }')
|
(! nix eval --store dummy:// --write-to $TEST_ROOT/eval-out --expr '{ "." = "bla"; }')
|
||||||
|
|
||||||
|
(! nix eval --expr '~/foo')
|
||||||
|
|
Loading…
Reference in a new issue