aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2023-06-05 15:43:12 +0200
committerEelco Dolstra <edolstra@gmail.com>2023-06-06 11:24:10 +0200
commitf5c6b299407e2ad5d05670bf4e89e18ebb113070 (patch)
treed937cc46b6cbdf4785839574c94c8feb8466dc88 /tests
parent9c6ede85fc3cd822b5c6b56045ff231a61fcd55f (diff)
Fix SourcePath::resolveSymlinks()
This fixes handling of symlinks that start with '..', and symlink targets that contain symlinks themselves.
Diffstat (limited to 'tests')
-rw-r--r--tests/eval.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/eval.sh b/tests/eval.sh
index 066d8fc36..b81bb1e2c 100644
--- a/tests/eval.sh
+++ b/tests/eval.sh
@@ -35,3 +35,9 @@ nix-instantiate --eval -E 'assert 1 + 2 == 3; true'
# Check that symlink cycles don't cause a hang.
ln -sfn cycle.nix $TEST_ROOT/cycle.nix
(! nix eval --file $TEST_ROOT/cycle.nix)
+
+# Check that relative symlinks are resolved correctly.
+mkdir -p $TEST_ROOT/xyzzy $TEST_ROOT/foo
+ln -sfn ../xyzzy $TEST_ROOT/foo/bar
+printf 123 > $TEST_ROOT/xyzzy/default.nix
+[[ $(nix eval --impure --expr "import $TEST_ROOT/foo/bar") = 123 ]]