docs/70985: [patch] sh(1): incomplete documentation of 'trap' builtin
Jilles Tjoelker
jilles at stack.nl
Mon Aug 30 16:17:22 UTC 2004
On Thu, Aug 26, 2004 at 12:54:10PM +0000, Simon L. Nielsen wrote:
> Synopsis: [patch] sh(1): incomplete documentation of 'trap' builtin
>
> Responsible-Changed-From-To: freebsd-doc->freebsd-standards
> Responsible-Changed-By: simon
> Responsible-Changed-When: Thu Aug 26 12:50:29 GMT 2004
> Responsible-Changed-Why:
> Over to the standards people so they can decide if we want to document
> that our shell is not fully standard complaint (according the to the
> PR - I haven't checked further) or if our sh should rather be changed.
> If the standards people think it should be documented, as described in
> the PR, feel free to throw this PR back to freebsd-doc.
> http://www.freebsd.org/cgi/query-pr.cgi?pr=70985
Documenting the POSIX way trap - action... seems good.
The non-compliancy in the PR is using trap with two or more actions to
reset the signal to default. For example "trap INT TERM" should set the
action for SIGTERM to "INT" but instead resets both SIGINT and SIGTERM
to default. The results from invoking trap with a single argument
(excluding options) are undefined in POSIX.
A small comparison with other shells: bash changed that from 2.x to 3.x
-- bash2 bahaves as FreeBSD sh here, while bash3 is POSIX-compliant here
(but allows resetting a signal to default with a single argument, like
"trap USR1"). zsh (4.2.0) and pdksh (5.2.14p2) behave as FreeBSD sh.
ksh93 behaves according to POSIX.
--
Jilles Tjoelker
More information about the freebsd-doc
mailing list