Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Aug 2004 18:17:20 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        "Simon L. Nielsen" <simon@FreeBSD.org>
Cc:        freebsd-standards@FreeBSD.org
Subject:   Re: docs/70985: [patch] sh(1): incomplete documentation of 'trap' builtin
Message-ID:  <20040830161720.GC17909@stack.nl>
In-Reply-To: <200408261254.i7QCsA4P092588@freefall.freebsd.org>
References:  <200408261254.i7QCsA4P092588@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040830161720.GC17909>