mirror of
https://github.com/NixOS/nix
synced 2025-07-07 14:21:48 +02:00
Don't allow appending a non-absolute path to the root of a source tree
This avoids an inconsistency where a '/' is implicitly inserted when you append to the root of a source tree, but not when you append to any other path.
This commit is contained in:
parent
d162222f25
commit
6d104bbbac
2 changed files with 10 additions and 1 deletions
|
@ -3,6 +3,10 @@ source common.sh
|
|||
mkdir -p $TEST_ROOT/foo
|
||||
echo bla > $TEST_ROOT/foo/bar
|
||||
|
||||
[[ $(nix eval --raw --impure --expr "builtins.readFile (builtins.toString (builtins.fetchTree { type = \"path\"; path = \"$TEST_ROOT/foo\"; } + \"bar\"))") = bla ]]
|
||||
[[ $(nix eval --raw --impure --expr "builtins.readFile (builtins.toString (builtins.fetchTree { type = \"path\"; path = \"$TEST_ROOT/foo\"; } + \"/bar\"))") = bla ]]
|
||||
|
||||
[[ $(nix eval --raw --impure --expr "builtins.readFile (builtins.toString (builtins.fetchTree { type = \"path\"; path = \"$TEST_ROOT/foo\"; } + \"/b\" + \"ar\"))") = bla ]]
|
||||
|
||||
(! nix eval --raw --impure --expr "builtins.fetchTree { type = \"path\"; path = \"$TEST_ROOT/foo\"; } + \"bar\"")
|
||||
|
||||
[[ $(nix eval --json --impure --expr "builtins.readDir (builtins.toString (builtins.fetchTree { type = \"path\"; path = \"$TEST_ROOT/foo\"; }))") = '{"bar":"regular"}' ]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue