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

View file

@ -474,6 +474,12 @@ set x y z
x=$(printf "a%-5sc" "b")
[ "$x" = "ab c" ] || warn 119
# Make sure cd supports -L and -P options properly
rm -f shlink
ln -s . shlink
(cd -L shlink/shlink/shlink/../shlink) || fail 120
(cd -P shlink/shlink/shlink/../shlink) && fail 121
[ -e shelltest.failed ] && exit 41
[ -e shelltest.warned ] && exit 42
exit 40