shelltest: detect the ". of empty script" shell problem.

This commit is contained in:
Avery Pennarun 2011-02-28 21:21:38 -08:00
commit 32f584cb1c
2 changed files with 10 additions and 0 deletions

2
t/nothing.od Normal file
View file

@ -0,0 +1,2 @@
# this shell script contains no commands.
# it's used for testing the return value of '. ./nothing.od' in shelltest.od.

View file

@ -280,5 +280,13 @@ lt
[ "$x" = "1" ] || fail 112
[ "$y$z" = "67" ] || fail 113
# reported by Tim Allen:
# some shells don't return 0 from an empty '.' script; they return the
# previous command's exit code instead.
# See:
# http://pubs.opengroup.org/onlinepubs/009695399/utilities/dot.html
# http://austingroupbugs.net/view.php?id=114
false
. ./nothing.od || warn 114
exit $FAIL