freebsd-dev/tools/regression/bin/sh/execution/func2.0
Jilles Tjoelker e16947f83d 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
2009-08-28 22:41:25 +00:00

12 lines
115 B
Plaintext

# $FreeBSD$
f() { }
f
hash -v f >/dev/null
f() { { }; }
f
hash -v f >/dev/null
f() { { } }
f
hash -v f >/dev/null