From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7855 invoked from network); 12 Feb 2005 21:30:14 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 12 Feb 2005 21:30:14 -0000 Received: (qmail 6407 invoked from network); 12 Feb 2005 21:30:08 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 Feb 2005 21:30:08 -0000 Received: (qmail 11104 invoked by alias); 12 Feb 2005 21:30:05 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20810 Received: (qmail 11061 invoked from network); 12 Feb 2005 21:30:05 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 12 Feb 2005 21:30:05 -0000 Received: (qmail 6045 invoked from network); 12 Feb 2005 21:29:29 -0000 Received: from out014pub.verizon.net (HELO out014.verizon.net) (206.46.170.46) by a.mx.sunsite.dk with SMTP; 12 Feb 2005 21:29:25 -0000 Received: from candle.brasslantern.com ([4.11.10.129]) by out014.verizon.net (InterMail vM.5.01.06.06 201-253-122-130-106-20030910) with ESMTP id <20050212212920.BPBH28388.out014.verizon.net@candle.brasslantern.com>; Sat, 12 Feb 2005 15:29:20 -0600 Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id j1CLTERo028825; Sat, 12 Feb 2005 13:29:15 -0800 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j1CLTEDB028824; Sat, 12 Feb 2005 13:29:14 -0800 From: Bart Schaefer Message-Id: <1050212212914.ZM28823@candle.brasslantern.com> Date: Sat, 12 Feb 2005 21:29:14 +0000 In-Reply-To: <20050212210429.GF49626@dan.emsphone.com> Comments: In reply to Dan Nelson "Re: trap .. EXIT doesn't execute when exit is due to a signal" (Feb 12, 3:04pm) References: <20050212122658.4ae2739b@buddha> <20050212210429.GF49626@dan.emsphone.com> X-Mailer: Z-Mail (5.0.0 30July97) To: Dan Nelson , "Matthias B." Subject: Re: trap .. EXIT doesn't execute when exit is due to a signal Cc: Zsh hackers list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Authentication-Info: Submitted using SMTP AUTH at out014.verizon.net from [4.11.10.129] at Sat, 12 Feb 2005 15:29:16 -0600 X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 On Feb 12, 3:04pm, Dan Nelson wrote: } Subject: Re: trap .. EXIT doesn't execute when exit is due to a signal } } In the last episode (Feb 12), Matthias B. said: } > trap ... EXIT doesn't execute ... when the shell is terminated due to } > a signal (e.g. Ctrl-C). I think this is a bug. It's certainly } > undesirable, because it causes cleanup tasks to not be executed. Bash } > doesn't have this problem. } } zsh-users 3513 describes what is happening here, I think. Ash and } /Solaris bin/sh have the same behaviour. Yep, that's exactly it. It just occured to me that it may very well be the case that bash is using the POSIX atexit() handler to execute its exit traps, which I believe would handle the situation described in 3513 without having to do any special handling of SIGINT. However, I'm not positive that covers all the cases in which zsh runs the exit trap, and it'd have to be used carefully to be sure the exit trap wasn't run more than once.