From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5416 invoked from network); 26 Jul 2004 13:07:01 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 26 Jul 2004 13:07:01 -0000 Received: (qmail 16678 invoked from network); 26 Jul 2004 13:06:55 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 26 Jul 2004 13:06:55 -0000 Received: (qmail 11736 invoked by alias); 26 Jul 2004 13:06:43 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20198 Received: (qmail 11727 invoked from network); 26 Jul 2004 13:06:43 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 26 Jul 2004 13:06:43 -0000 Received: (qmail 15309 invoked from network); 26 Jul 2004 13:05:10 -0000 Received: from lhuumrelay3.lnd.ops.eu.uu.net (62.189.58.19) by a.mx.sunsite.dk with SMTP; 26 Jul 2004 13:05:09 -0000 Received: from MAILSWEEPER01.csr.com (mailhost1.csr.com [62.189.183.235]) by lhuumrelay3.lnd.ops.eu.uu.net (8.11.0/8.11.0) with ESMTP id i6QD58v08776 for ; Mon, 26 Jul 2004 13:05:08 GMT Received: from EXCHANGE02.csr.com (unverified [192.168.137.45]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id ; Mon, 26 Jul 2004 14:04:24 +0100 Received: from news01.csr.com ([192.168.143.38]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 26 Jul 2004 14:06:56 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.12.11/8.12.11) with ESMTP id i6QD57aH010628; Mon, 26 Jul 2004 14:05:07 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.12.11/8.12.11/Submit) with ESMTP id i6QD564O010625; Mon, 26 Jul 2004 14:05:06 +0100 Message-Id: <200407261305.i6QD564O010625@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: Dave Yost , zsh-workers@sunsite.dk Subject: Re: zsh malloc bug In-reply-to: "Dave Yost"'s message of "Wed, 16 Jun 2004 12:16:55 PDT." Date: Mon, 26 Jul 2004 14:05:06 +0100 From: Peter Stephenson X-OriginalArrivalTime: 26 Jul 2004 13:06:56.0071 (UTC) FILETIME=[6D6CED70:01C47311] X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-4.9 required=6.0 tests=BAYES_00 autolearn=no version=2.63 X-Spam-Hits: -4.9 Dave Yost wrote: > A real example follows. Finaly got around to looking, thanks for the script. Rather embarassingly, it turns out EXIT traps on scripts are completely broken. You just need to do: zsh -fc 'TRAPEXIT() { print Ooh-er.; }' It's now documented that special traps such as EXIT don't run inside other traps, so the following simple fix ought to be fine. Are there any remaining trap problems after this? I added a variable to give the name of the zsh executable inside tests, so we can test this kind of thing. As you'll see it's a bit imperfect. Index: Src/exec.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/exec.c,v retrieving revision 1.67 diff -u -r1.67 exec.c --- Src/exec.c 7 Jul 2004 15:00:57 -0000 1.67 +++ Src/exec.c 26 Jul 2004 13:02:33 -0000 @@ -3495,7 +3495,8 @@ memcpy(oldpipestats, pipestats, bytes); } - starttrapscope(); + if (!intrap) + starttrapscope(); tab = pparams; if (!(flags & PM_UNDEFINED)) @@ -3595,7 +3596,8 @@ opts[LOCALOPTIONS] = saveopts[LOCALOPTIONS]; } - endtrapscope(); + if (!intrap) + endtrapscope(); if (trapreturn < -1) trapreturn++; Index: Src/signals.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/signals.c,v retrieving revision 1.28 diff -u -r1.28 signals.c --- Src/signals.c 2 May 2004 19:55:58 -0000 1.28 +++ Src/signals.c 26 Jul 2004 13:02:34 -0000 @@ -939,6 +939,10 @@ * with non-standard sigtrapped & sigfuncs values */ +/* Are we already executing a trap? */ +/**/ +int intrap; + /**/ void dotrapargs(int sig, int *sigtr, void *sigfn) @@ -949,9 +953,6 @@ int obreaks = breaks; int isfunc; - /* Are we already executing a trap? */ - static int intrap; - /* if signal is being ignored or the trap function * * is NULL, then return * * * Index: Test/C03traps.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/C03traps.ztst,v retrieving revision 1.3 diff -u -r1.3 C03traps.ztst --- Test/C03traps.ztst 10 Mar 2004 10:50:03 -0000 1.3 +++ Test/C03traps.ztst 26 Jul 2004 13:02:34 -0000 @@ -57,6 +57,13 @@ >Function 1 going >Function 2 going +# $ZTST_exe is relative to the parent directory. +# We ought to fix this in ztst.zsh... + cd .. + $ZTST_exe -fc 'TRAPEXIT() { print Exited.; }' +0:EXIT traps on a script +>Exited. + fn1() { trap trap 'print INT1' INT Index: Test/Makefile.in =================================================================== RCS file: /cvsroot/zsh/zsh/Test/Makefile.in,v retrieving revision 1.7 diff -u -r1.7 Makefile.in --- Test/Makefile.in 12 Aug 2001 19:43:13 -0000 1.7 +++ Test/Makefile.in 26 Jul 2004 13:02:34 -0000 @@ -46,7 +46,8 @@ $(MAKE) MODDIR=`pwd`/$(subdir)/Modules install.modules > /dev/null; \ fi -for f in $(sdir)/$(TESTNUM)*.ztst; do \ - $(dir_top)/Src/zsh +Z -f $(sdir)/ztst.zsh $$f; \ + ZTST_exe=$(dir_top)/Src/zsh \ + $(dir_top)/Src/zsh +Z -f $(sdir)/ztst.zsh $$f; \ done rm -rf Modules .zcompdump Index: Test/ztst.zsh =================================================================== RCS file: /cvsroot/zsh/zsh/Test/ztst.zsh,v retrieving revision 1.18 diff -u -r1.18 ztst.zsh --- Test/ztst.zsh 5 Aug 2002 13:10:03 -0000 1.18 +++ Test/ztst.zsh 26 Jul 2004 13:02:35 -0000 @@ -31,6 +31,8 @@ # Set the module load path to correspond to this build of zsh. # This Modules directory should have been created by "make check". [[ -d Modules/zsh ]] && module_path=( $PWD/Modules ) +# Allow this to be passed down. +export MODULE_PATH # We need to be able to save and restore the options used in the test. # We use the $options variable of the parameter module for this. -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************