From owner-freebsd-doc@FreeBSD.ORG Thu Aug 26 11:20:27 2004 Return-Path: Delivered-To: freebsd-doc@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AFE1616A4D0 for ; Thu, 26 Aug 2004 11:20:27 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7507C43D6E for ; Thu, 26 Aug 2004 11:20:26 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i7QBKQPU083173 for ; Thu, 26 Aug 2004 11:20:26 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i7QBKQVB083168; Thu, 26 Aug 2004 11:20:26 GMT (envelope-from gnats) Resent-Date: Thu, 26 Aug 2004 11:20:26 GMT Resent-Message-Id: <200408261120.i7QBKQVB083168@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-doc@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, dada@sbox.tugraz.at Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2506216A4CE for ; Thu, 26 Aug 2004 11:18:39 +0000 (GMT) Received: from mailrelay02.tugraz.at (mailrelay.tu-graz.ac.at [129.27.3.7]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2C81943D67 for ; Thu, 26 Aug 2004 11:18:38 +0000 (GMT) (envelope-from dada@sbox.tugraz.at) Received: from webmail.tugraz.at (webmail02.tu-graz.ac.at [129.27.3.144]) by mailrelay02.tugraz.at (8.13.1/8.13.1) with ESMTP id i7QBIQ56007475 for ; Thu, 26 Aug 2004 13:18:26 +0200 (CEST) Received: from ARP408.kfunigraz.ac.at (ARP408.kfunigraz.ac.at ; Thu, 26 Aug 2004 13:18:27 +0200 Message-Id: <20040826131827.k8s0cwko4c0wwkgw@webmail.tugraz.at> Date: Thu, 26 Aug 2004 13:18:27 +0200 From: dada@sbox.tugraz.at To: FreeBSD problem reports Subject: docs/70985: [patch] sh(1): incomplete documentation of 'trap' builtin X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Aug 2004 11:20:27 -0000 >Number: 70985 >Category: docs >Synopsis: [patch] sh(1): incomplete documentation of 'trap' builtin >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Thu Aug 26 11:20:25 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Martin Kammerhofer >Release: FreeBSD 4.10-RELEASE-p2 i386 >Organization: Graz Uni >Environment: System: FreeBSD Martin.liebt.Susi 4.10-RELEASE-p2 FreeBSD 4.10-RELEASE-p2 #1: Mon Aug 16 14:26:52 CEST 2004 toor@Martin.liebt.Susi:/mnt/redhat/freebsd/usr/src/sys/compile/GEIDORF4 i386 >Description: The sh(1) manpage describes the trap builtin as follows: The action may be null or omitted; the former causes the specified signal to be ignored and the latter causes the default action to be taken. Compare this to a quote from SUSv3: If action is '-' , the shell shall reset each condition to the default value. If action is null ( "" ), the shell shall ignore each specified condition if it arises. There is a slight difference here. Our sh(1) uses a nonexistent action to signify the default action while the standard calls for a dash. Omitting the action argument causes incompatibility with other shells, e.g. ksh93 from the ports collection. (Our shell does already handle the '-' action correctly. But is undocumented.) Invocation as 'trap -l' to list available signal names is not documented either. >How-To-Repeat: man sh >Fix: Emphasize the POSIX way of specifying the default signal action. Document "trap -l". Index: sh.1 =================================================================== RCS file: /home/ncvs/src/bin/sh/sh.1,v retrieving revision 1.92 diff -u -t -r1.92 sh.1 --- sh.1 3 Jul 2004 02:03:44 -0000 1.92 +++ sh.1 26 Aug 2004 09:49:04 -0000 @@ -1880,6 +1880,7 @@ decreasing the value of $# by one. If there are zero positional parameters, shifting does not do anything. .It Ic trap Oo Ar action Oc Ar signal ... +.It Ic trap Fl l Cause the shell to parse and execute .Ar action when any specified @@ -1891,14 +1892,25 @@ may be used to specify an action that is performed when the shell terminates. The .Ar action -may be null or omitted; +may be null or a dash +.Pq Ar - +; the former causes the specified signal to be ignored and the latter causes the default action to be taken. +Omitting the +.Ar action +is another way to request the default action. When the shell forks off a subshell, it resets trapped (but not ignored) signals to the default action. The .Ic trap command has no effect on signals that were ignored on entry to the shell. +.Pp +Option +.Fl l +causes the +.Ic trap +command to display a list of valid signal names. .It Ic type Op Ar name ... Interpret each .Ar name --=_1p8ho7sy71us-- >Release-Note: >Audit-Trail: >Unformatted: This message is in MIME format. --=_1p8ho7sy71us Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 7bit --=_1p8ho7sy71us Content-Type: text/plain; charset=UTF-8; name="sh.pr" Content-Disposition: inline; filename="sh.pr" Content-Transfer-Encoding: 7bit