From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1889 invoked by alias); 11 Jan 2011 03:25:12 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28624 Received: (qmail 2179 invoked from network); 11 Jan 2011 03:25:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.216.178 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=af1P3QhUJaDeXzR6HaVlEphHbVHlcm4CLarvuXEHnek=; b=HJfb538kRRWBX4tJtZga/ULAbo9SGq4aknMyWwL3WzmNl9Pwui5bsjqjxBSOCGmW42 2XiaET/1MlMS06jf7kWOILHzx4YM2I3R2ZDCBJoaFAfw8IcO7UM7/PyNcA7cYXusYAA6 oCOyQ9h61I5y4aAp3z8sqQIP/wXxwVejx5zKU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=MWQdnQ2QnmmIRzstrnMYB6DM7lhldDGZCguRb0mUOK4HpilotuUB/Vyl6L05tNJwQK h30q7KfMCPwBk8Ep4Mg+xg28PfyLOcpusS9a5M9LyX5LypdDX8+yKZeCMRTfoGO1TQu6 ksquUJ4snimTC7Rs4Ld2XGr4eqlr44Ha9satE= MIME-Version: 1.0 In-Reply-To: <1294714469.3446.1414534693@webmail.messagingengine.com> References: <1294704977.26846.1414490063@webmail.messagingengine.com> <1294710389.18824.1414500371@webmail.messagingengine.com> <1294714469.3446.1414534693@webmail.messagingengine.com> Date: Tue, 11 Jan 2011 04:25:01 +0100 Message-ID: Subject: Re: 4.3.11 TRAPEXIT() on cygwin From: Mikael Magnusson To: Anthony Heading Cc: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 On 11 January 2011 03:54, Anthony Heading wrote: > On Tue, 11 Jan 2011 02:50 +0100, "Mikael Magnusson" > wrote: >> > echo $( trap 'echo exiting' EXIT) >> > >> > or similar substitutions. That's quite clearly a subshell entering to >> > the same extent a ( ... ) is. >> >> How is that different from what you wrote? > > Well, the examples you quote are traps set within a subshell, which may > or may not propagate higher. > > My problem is that the subshell is inheriting the parent trap action. > > That seems obviously different, and POSIX seems pretty clear: > > When a subshell is entered, traps that are not being ignored shall > be set to the default actions, except in the case of a command > substitution containing only a single trap command, when the traps > need not be altered. Ah, the manpage says this ( list ) Execute list in a subshell. Traps set by the trap builtin are reset to their default values while executing list. and it is true: % trap 'echo hello >&2' EXIT % a=$(ls) % TRAPEXIT() { echo function hello >&2 } % a=$(ls) function hello -- Mikael Magnusson