From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16637 invoked from network); 2 Oct 2001 15:33:27 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 2 Oct 2001 15:33:27 -0000 Received: (qmail 22465 invoked by alias); 2 Oct 2001 15:33:18 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15927 Received: (qmail 22453 invoked from network); 2 Oct 2001 15:33:18 -0000 To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: test for trap EXIT fix. In-reply-to: "Bart Schaefer"'s message of "Tue, 02 Oct 2001 15:19:01 -0000." <1011002151901.ZM24646@candle.brasslantern.com> Date: Tue, 02 Oct 2001 16:32:44 +0100 Message-ID: <25575.1002036764@csr.com> From: Peter Stephenson Bart Schaefer wrote: > On Oct 2, 3:39pm, Peter Stephenson wrote: > } We may be able to do some special tricks with `exiting' at the end of > } execlist(), making sure we don't exit too early from lower down in that > } case (because of the optimization for a final command to be exec'd if > } there's nothing left to do). Then we just execute any top level EXIT trap > } which has been left to us. > > I'm having a hard time grokking "top level EXIT trap" in that context, > but I think you must be thinking the right thing, because I can't find > any other interpretation that makes sense. `Top level' means whatever's on the front of the list of EXIT traps. It's about the only thing we've got we could possibly execute as a trap. If I'm following my own logic properly, this means fn() { function TRAPEXIT { echo foo; } ( true ) ( exit ) } would execute the trap when the subshells exit (as well as when the function exits), because the function-type trap is not deleted at the start of the subshell, and is what we have waiting in the queue on the next exit from anything. This would match the behaviour the code were executed outside the function. The 4.0 behaviour is that only the explicit exit produces a trap; falling off the end of the subshell in `( true )' doesn't. I would guess this is wrong and they should be equivalent. That may require more special handling. -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 392070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************