runtests is typically run under /bin/sh. If the user uses a different
interactive shell (such as /bin/ksh) that maintains the PWD environment
variable, but /bin/sh does not, then the 'cd t' line in runtests ends
up changing the working directory without updating $PWD. Several tests
in t/io/fs.t rely on being able to change directories and then get back
to the original. The tests assume that if $PWD is set at all, then
it is set correctly. This fix changes runtests to ensure it is so.
cd t
+# If this is run under an old shell that doesn't automatically
+# update PWD, then we must update it. Otherwise, t/io/fs.t gets
+# mixed up about what directory we are in.
+case "$PWD" in
+ '') ;; # Do nothing if it isn't set at all.
+ */t) ;; # Leave it alone if it's properly updated.
+ *) PWD=${PWD}/t; export PWD ;; # Otherwise, fix it.
+esac
+
!NO!SUBS!
## In the following, dollars and backticks do need the extra backslash.