Fix more inconsistent behaviour with symlinks in paths.

Both redo and minimal/do were doing slightly weird things with
symlinked directories, especially when combined with "..".  For
example, if x is a link to ., then x/x/x/x/../y should resolve to
"../y", which is quite non-obvious.

Added some tests to make sure this stays fixed.
This commit is contained in:
Avery Pennarun 2018-12-17 15:58:06 +00:00
commit 686c381109
13 changed files with 121 additions and 8 deletions

5
do
View file

@ -66,6 +66,11 @@ case $target in
build && bin/redo $args "$target"
;;
test)
# Be intentionally confusing about paths, to try to
# detect bugs.
rm -f 't/symlink path'
ln -s .. 't/symlink path' || die 'failed to make test dir.'
cd 't/symlink path/t/symlink path'
# First test minimal/do
build
# Add ./redo to PATH so we launch with redo/sh as the shell