summaryrefslogtreecommitdiffstats
path: root/tools/regression/bin/sh/execution/func2.0
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2009-08-28 22:41:25 +0000
committerjilles <jilles@FreeBSD.org>2009-08-28 22:41:25 +0000
commit0bf6e8da4eba6a1fb35ec2e5b2db62e53fec7d32 (patch)
tree7a8084b831c46519ff07655affc5c604f115d66a /tools/regression/bin/sh/execution/func2.0
parent9940277b0b89316256a4ba3df75a0b17de8b7157 (diff)
downloadFreeBSD-src-0bf6e8da4eba6a1fb35ec2e5b2db62e53fec7d32.zip
FreeBSD-src-0bf6e8da4eba6a1fb35ec2e5b2db62e53fec7d32.tar.gz
sh: Fix crash with empty functions (f() { }) introduced in r196483
Empty pairs of braces are represented by a NULL node pointer, just like empty lines at the top level. Support for empty pairs of braces may be removed later. They make the code more complex, have inconsistent behaviour (may or may not change $?), are not specified by POSIX and are not allowed by some other shells like bash, dash and ksh93. Reported by: kan
Diffstat (limited to 'tools/regression/bin/sh/execution/func2.0')
-rw-r--r--tools/regression/bin/sh/execution/func2.011
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/execution/func2.0 b/tools/regression/bin/sh/execution/func2.0
new file mode 100644
index 0000000..affa802
--- /dev/null
+++ b/tools/regression/bin/sh/execution/func2.0
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+f() { }
+f
+hash -v f >/dev/null
+f() { { }; }
+f
+hash -v f >/dev/null
+f() { { } }
+f
+hash -v f >/dev/null
OpenPOWER on IntegriCloud