From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11912 invoked from network); 3 Nov 2003 11:24:39 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 3 Nov 2003 11:24:39 -0000 Received: (qmail 5316 invoked by alias); 3 Nov 2003 11:24:30 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19216 Received: (qmail 5301 invoked from network); 3 Nov 2003 11:24:29 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 3 Nov 2003 11:24:29 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [202.214.225.228] by sunsite.dk (MessageWall 1.0.8) with SMTP; 3 Nov 2003 11:24:28 -0000 Received: from exchangejp.csr.com (unverified) by mailsweeperjp.CSR.COM (Content Technologies SMTPRS 4.3.1) with ESMTP id for ; Mon, 3 Nov 2003 20:25:25 +0900 Received: from EXCHANGE02.csr.com ([192.168.137.45]) by exchangejp.csr.com with Microsoft SMTPSVC(5.0.2195.5329); Mon, 3 Nov 2003 11:25:22 +0000 Received: from csr.com ([192.168.144.127]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.5329); Mon, 3 Nov 2003 11:25:19 +0000 To: Zsh workers Subject: Re: $pipestatus broken In-reply-to: "Bart Schaefer"'s message of "Mon, 03 Nov 2003 01:55:38 GMT." <1031103015538.ZM607@candle.brasslantern.com> Date: Mon, 03 Nov 2003 11:24:21 +0000 Message-ID: <22349.1067858661@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 03 Nov 2003 11:25:19.0660 (UTC) FILETIME=[29CCEEC0:01C3A1FD] Bart Schaefer wrote: > I think there's code to save and restore `lastval' around precmd(), but > it doesn't save and restore the entire `pipestats' array. It's in doshfunc. It would be more efficient to save in restore in preprompt(), but at the expense of extra code. I think the first chunk is some debugging code which should have been deleted. I can guess who put that there. There still doesn't seem to be a dupmem function... Index: Src/exec.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/exec.c,v retrieving revision 1.54 diff -u -r1.54 exec.c --- Src/exec.c 29 Oct 2003 19:17:30 -0000 1.54 +++ Src/exec.c 3 Nov 2003 11:18:23 -0000 @@ -3064,8 +3064,6 @@ if (!out) { addproc(pid, NULL, 1); - fprintf(stderr, "Proc %d added\n", pid); - fflush(stderr); } return pnam; } @@ -3448,7 +3446,8 @@ * was executed. */ { char **tab, **x, *oargv0; - int oldzoptind, oldlastval, oldoptcind; + int oldzoptind, oldlastval, oldoptcind, oldnumpipestats; + int *oldpipestats = NULL; char saveopts[OPT_SIZE], *oldscriptname = scriptname, *fname = dupstring(name); int obreaks; struct funcstack fstack; @@ -3463,6 +3462,16 @@ if (trapreturn < 0) trapreturn--; oldlastval = lastval; + oldnumpipestats = numpipestats; + if (noreturnval) { + /* + * Easiest to use the heap here since we're bracketed + * immediately by a pushheap/popheap pair. + */ + size_t bytes = sizeof(int)*numpipestats; + oldpipestats = (int *)zhalloc(bytes); + memcpy(oldpipestats, pipestats, bytes); + } starttrapscope(); @@ -3568,8 +3577,11 @@ if (trapreturn < -1) trapreturn++; - if (noreturnval) + if (noreturnval) { lastval = oldlastval; + numpipestats = oldnumpipestats; + memcpy(pipestats, oldpipestats, sizeof(int)*numpipestats); + } popheap(); if (exit_pending) { -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** 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. **********************************************************************