From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24641 invoked from network); 31 Jul 2008 09:02:01 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,WEIRD_PORT autolearn=no version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 31 Jul 2008 09:02:01 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 61847 invoked from network); 31 Jul 2008 09:01:53 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 31 Jul 2008 09:01:53 -0000 Received: (qmail 15443 invoked by alias); 31 Jul 2008 09:01:50 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25361 Received: (qmail 15432 invoked from network); 31 Jul 2008 09:01:49 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 31 Jul 2008 09:01:49 -0000 Received: from cluster-d.mailcontrol.com (cluster-d.mailcontrol.com [217.69.20.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 94F1D805A42E for ; Thu, 31 Jul 2008 11:01:45 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly45d.srv.mailcontrol.com (MailControl) with ESMTP id m6V91hls012063 for ; Thu, 31 Jul 2008 10:01:43 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Thu, 31 Jul 2008 10:01:43 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.14.2/8.13.4) with ESMTP id m6V91hc9002482 for ; Thu, 31 Jul 2008 10:01:43 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.14.2/8.14.2/Submit) with ESMTP id m6V91g8T002478 for ; Thu, 31 Jul 2008 10:01:43 +0100 Message-Id: <200807310901.m6V91g8T002478@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk Subject: Re: Weird exit caused in a trap DEBUG which sources a file. In-reply-to: <6cd6de210807301938m28e05c84vf6296aa5b1bc0d44@mail.gmail.com> References: <6cd6de210807301938m28e05c84vf6296aa5b1bc0d44@mail.gmail.com> Comments: In-reply-to "Rocky Bernstein" message dated "Wed, 30 Jul 2008 22:38:23 -0400." Date: Thu, 31 Jul 2008 10:01:42 +0100 From: Peter Stephenson X-OriginalArrivalTime: 31 Jul 2008 09:01:43.0120 (UTC) FILETIME=[0D684500:01C8F2EC] X-Scanned-By: MailControl A-08-50-03 (www.mailcontrol.com) on 10.68.0.155 X-Virus-Scanned: ClamAV 0.92.1/7898/Thu Jul 31 08:42:41 2008 on bifrost X-Virus-Status: Clean "Rocky Bernstein" wrote: > Below is a small program whittled down from a larger one. It has > behavior I can't figure out. > > It seems to show that when a function is called via trap DEBUG and you > then source a file and it has a statement in it, on return from the > TRAP an exit will be taken. Here is the program: > > #!/usr/bin/zsh > function debug_trap_handler { > print $functrace[1] > do_bug > } > > function do_bug { > . ./bug-file > } > > trap 'echo EXIT hit' EXIT > trap 'debug_trap_handler' DEBUG > a=1 > b=2 > d=3 > > In "bug-file" put any command. ":" will do. Or a print statement. > Let's say it contains the line: > print bug file here > > When I run the above I get: > > $ ./zshtrace.sh > > ./zshtrace.sh:12 > bug file here > EXIT hit That certainly looks like a bug, but it didn't happen for me. What version of the shell do you have, and does it happen with the -f option after /usr/bin/zsh? -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070