]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
sh: Fix the trap builtin to be POSIX-compliant for 'trap exit SIG' and 'trap n n...
authorbdrewery <bdrewery@FreeBSD.org>
Sat, 18 Apr 2015 23:49:57 +0000 (23:49 +0000)
committerbdrewery <bdrewery@FreeBSD.org>
Sat, 18 Apr 2015 23:49:57 +0000 (23:49 +0000)
commit5ae6ee36a954c208f9859b1596737b5e75fbef3f
tree9ce9623e515c474ad35bc9eb956e5841ab94f157
parentbcb929d8e83e31f96e4ae6b2b578c5f1eb738c8a
sh: Fix the trap builtin to be POSIX-compliant for 'trap exit SIG' and 'trap n n...'.

The parser considered 'trap exit INT' to reset the default for both EXIT and
INT. This beahvior is not POSIX compliant. This was avoided if a value was
specified for 'exit', but then disallows exiting with the signal received. A
possible workaround is using ' exit'.

However POSIX does allow this type of behavior if the parameters are all
integers. Fix the handling for this and clarify its support in the manpage
since it is specifically allowed by POSIX.

Differential Revision: https://reviews.freebsd.org/D2325
Reviewed by: jilles
MFC after: 2 weeks
bin/sh/sh.1
bin/sh/tests/builtins/Makefile
bin/sh/tests/builtins/trap15.0 [new file with mode: 0644]
bin/sh/tests/builtins/trap16.0 [new file with mode: 0644]
bin/sh/trap.c