sh: Add test for exit status of for loop without items.
authorPeter Avalos <pavalos@dragonflybsd.org>
Sun, 25 Dec 2011 17:35:56 +0000 (09:35 -0800)
committerPeter Avalos <pavalos@dragonflybsd.org>
Sun, 25 Dec 2011 17:35:56 +0000 (09:35 -0800)
POSIX says the exit status of a for loop without any items shall be 0.
There are no exceptions if the exit status of the previous command was
not 0 or if the item list contains a command substitution with non-zero
exit status.

Obtained-from:  FreeBSD 226892

tools/regression/bin/sh/builtins/for1.0 [new file with mode: 0644]

diff --git a/tools/regression/bin/sh/builtins/for1.0 b/tools/regression/bin/sh/builtins/for1.0
new file mode 100644 (file)
index 0000000..8343cdb
--- /dev/null
@@ -0,0 +1,4 @@
+# $FreeBSD: src/tools/regression/bin/sh/builtins/for1.0,v 1.1 2011/10/28 23:02:21 jilles Exp $
+
+false
+for i in `false`; do exit 3; done