From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18423 invoked from network); 4 Mar 2009 16:37:04 -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.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham 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; 4 Mar 2009 16:37:04 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 57740 invoked from network); 4 Mar 2009 16:36:58 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Mar 2009 16:36:58 -0000 Received: (qmail 14545 invoked by alias); 4 Mar 2009 16:36:53 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26689 Received: (qmail 14528 invoked from network); 4 Mar 2009 16:36:52 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 4 Mar 2009 16:36:52 -0000 Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [208.87.233.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 723B88058F82 for ; Wed, 4 Mar 2009 17:36:47 +0100 (CET) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly13g.srv.mailcontrol.com (MailControl) with ESMTP id n24GYAAJ022473 for ; Wed, 4 Mar 2009 16:36:33 GMT Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Wed, 4 Mar 2009 16:32:48 +0000 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.14.2/8.13.4) with ESMTP id n24GWmZ4008201 for ; Wed, 4 Mar 2009 16:32:48 GMT Received: from csr.com (pws@localhost) by news01.csr.com (8.14.2/8.14.2/Submit) with ESMTP id n24GWmLk008197 for ; Wed, 4 Mar 2009 16:32:48 GMT Message-Id: <200903041632.n24GWmLk008197@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh workers Subject: Re: zsh segfaults with lots of data in one variable In-reply-to: <2d460de70903040709v543ee0c7ie1258bdee8177463@mail.gmail.com> References: <20090303210729.GU4167@fsst.voodoo.lan> <20090303220347.36279ac1@pws-pc> <2d460de70903040709v543ee0c7ie1258bdee8177463@mail.gmail.com> Comments: In-reply-to Richard Hartmann message dated "Wed, 04 Mar 2009 16:09:29 +0100." Date: Wed, 04 Mar 2009 16:32:48 +0000 From: Peter Stephenson X-OriginalArrivalTime: 04 Mar 2009 16:32:48.0239 (UTC) FILETIME=[DAB3AFF0:01C99CE6] X-Scanned-By: MailControl A_08_51_00 (www.mailcontrol.com) on 10.71.0.123 X-Virus-Scanned: ClamAV 0.92.1/9067/Wed Mar 4 11:06:09 2009 on bifrost X-Virus-Status: Clean Richard Hartmann wrote: > On Tue, Mar 3, 2009 at 23:03, Peter Stephenson > wrote: > > > However, in our case it's easy to fix just using ordindary malloc memory > > for saving $_. =C2=A0It would be much more efficient to mark underscore as > > "push old value to stack on write", or something similar, but if I try > > that at ten o'clock in the evening I'll get it wrong. > > Do you want to revisit this at a later time? If yes, I will mark this as bug > and put it into SF's bug tracker after some time (usually you are simply too > fast for me to actually put anything in there ;) On the whole, I suspect it's not worth it. The shell is optimised for moving around strings of a few dozen bytes or so. To do it better, we'd need some sort of a stack; that means an additional allocation. That's going to add to the complexity in the vast majority of cases just to improve the occasional case where $_ is some huge string on entry to a function. I don't regard this as a bug, anyway, so I think we can ignore it for now. Ta. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070