minimal/do: use 'pwd -P' instead of '/bin/pwd'.

On MacOS (at least 10.11.6), /bin/pwd defaults to using $PWD (ie.  pwd
-L).  On most other OSes it defaults to *not* using $PWD (ie.  pwd -P).
We need the latter behaviour.  It appears that 'pwd -P' has been
specified by POSIX for quite a few years now, so let's rely on it.
shelltest.od will now also check for it, though if your 'sh' doesn't
support this feature, it'll be too late, because shelltest needs
minimal/do in order to run.
This commit is contained in:
Avery Pennarun 2019-01-01 19:10:55 -05:00
commit 613fcb1c34
2 changed files with 7 additions and 3 deletions

View file

@ -517,6 +517,10 @@ rm -f shlink
ln -s . shlink
(quiet_stderr cd -L shlink/shlink/shlink/../shlink) || fail 120
(quiet_stderr cd -P shlink/shlink/shlink/../shlink) && fail 121
x1=$(cd shlink && basename "$(pwd -P)")
x2=$(cd shlink && basename "$(pwd -L)")
[ "$x1" = "t" ] || fail 122
[ "$x2" = "shlink" ] || fail 123
[ -e shelltest.failed ] && exit 41
[ -e shelltest.warned ] && exit 42