From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19242 invoked from network); 2 Feb 2005 03:48:53 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 2 Feb 2005 03:48:53 -0000 Received: (qmail 39501 invoked from network); 2 Feb 2005 03:48:46 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 2 Feb 2005 03:48:46 -0000 Received: (qmail 33 invoked by alias); 2 Feb 2005 03:48:42 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20774 Received: (qmail 19 invoked from network); 2 Feb 2005 03:48:41 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 2 Feb 2005 03:48:41 -0000 Received: (qmail 39161 invoked from network); 2 Feb 2005 03:48:05 -0000 Received: from out004pub.verizon.net (HELO out004.verizon.net) (206.46.170.142) by a.mx.sunsite.dk with SMTP; 2 Feb 2005 03:48:01 -0000 Received: from candle.brasslantern.com ([4.11.10.129]) by out004.verizon.net (InterMail vM.5.01.06.06 201-253-122-130-106-20030910) with ESMTP id <20050202034759.HGKN26988.out004.verizon.net@candle.brasslantern.com> for ; Tue, 1 Feb 2005 21:47:59 -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 j123ltQG010214 for ; Tue, 1 Feb 2005 19:47:55 -0800 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j123lsH7010213 for zsh-workers@sunsite.dk; Tue, 1 Feb 2005 19:47:55 -0800 From: Bart Schaefer Message-Id: <1050202034754.ZM10212@candle.brasslantern.com> Date: Wed, 2 Feb 2005 03:47:54 +0000 In-Reply-To: <1050201164011.ZM9367@candle.brasslantern.com> Comments: In reply to Bart Schaefer "Re: handling of variables" (Feb 1, 4:40pm) References: <2005-02-01T12-49-14@devnull.michael-prokop.at> <200502011410.j11EAA9D029705@news01.csr.com> <1050201152428.ZM9278@candle.brasslantern.com> <1050201164011.ZM9367@candle.brasslantern.com> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk Subject: Re: handling of variables MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Authentication-Info: Submitted using SMTP AUTH at out004.verizon.net from [4.11.10.129] at Tue, 1 Feb 2005 21:47:56 -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=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 [moved to -workers] On Feb 1, 4:40pm, Bart Schaefer wrote: } } I now think that exec.c:save_params() needs to copy the value returned } by ecrawstr() before storing it in the restore_p linked list That should say "remove_p" not "restore_p". } but I'm not sure what kind of memory to copy it into Got a chance to look at this again; addlinknode() uses the heap, so it should be safe to dupstring() here. And the following does indeed fix the problem. Index: Src/exec.c =================================================================== diff -c -r1.23 exec.c --- Src/exec.c 13 Jan 2005 04:12:14 -0000 1.23 +++ Src/exec.c 2 Feb 2005 03:41:43 -0000 @@ -2554,10 +2554,10 @@ copyparam(tpm, pm, 1); pm = tpm; } - addlinknode(*remove_p, s); + addlinknode(*remove_p, dupstring(s)); addlinknode(*restore_p, pm); } else - addlinknode(*remove_p, s); + addlinknode(*remove_p, dupstring(s)); pc += (WC_ASSIGN_TYPE(ac) == WC_ASSIGN_SCALAR ? 3 : WC_ASSIGN_NUM(ac) + 2);