From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10041 invoked from network); 3 Jun 2007 14:30:54 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=no version=3.2.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 3 Jun 2007 14:30:54 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 4160 invoked from network); 3 Jun 2007 14:30:47 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 3 Jun 2007 14:30:47 -0000 Received: (qmail 8952 invoked by alias); 3 Jun 2007 14:30:44 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23509 Received: (qmail 8942 invoked from network); 3 Jun 2007 14:30:43 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 3 Jun 2007 14:30:43 -0000 Received: (qmail 3849 invoked from network); 3 Jun 2007 14:30:43 -0000 Received: from mtaout01-winn.ispmail.ntl.com (81.103.221.47) by a.mx.sunsite.dk with SMTP; 3 Jun 2007 14:30:34 -0000 Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com with ESMTP id <20070603143033.JPWI12936.mtaout01-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Sun, 3 Jun 2007 15:30:33 +0100 Received: from pws-pc.ntlworld.com ([81.107.45.67]) by aamtaout01-winn.ispmail.ntl.com with ESMTP id <20070603143033.CUVT219.aamtaout01-winn.ispmail.ntl.com@pws-pc.ntlworld.com> for ; Sun, 3 Jun 2007 15:30:33 +0100 Received: from pws-pc.ntlworld.com (pws-pc.ntlworld.com [127.0.0.1]) by pws-pc.ntlworld.com (8.13.8/8.13.8) with ESMTP id l53EUOPN017562 for ; Sun, 3 Jun 2007 15:30:24 +0100 Message-Id: <200706031430.l53EUOPN017562@pws-pc.ntlworld.com> From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: [Bug] ZSH segmentation fault In-Reply-To: Message from matthieu kermagoret of "Sun, 03 Jun 2007 12:02:20 +0200." <200706031002.l53A2KT10810@epita.fr> Date: Sun, 03 Jun 2007 15:30:24 +0100 matthieu kermagoret wrote: > Hello ! > > I just found a bug in ZSH with double left redirection. > First I generate a file like this : > > echo "cat << EOF" > segfault_file > > for i in `seq 10000`; do echo `printf "%010000d" 0` >> segfault_file; done > > Then I try to make it execute to ZSH like this : > > zsh < segfault_file > > After a little while ZSH segfaults ! Hmm... you've made the shell use massive amounts of memory and it's crashed when it didn't have enough. (On my laptop with 2 gigabytes of main memory and the same amount of swap this doesn't crash, at least with the latest version of the shell.) The problem is that the shell actually keeps the here document in memory. This seems a bit lazy because it needs to write it to a temporary file later anyway. However, there are case where this is very difficult to handle any other way. Consider a shell function: fn() { cat < Web page now at http://homepage.ntlworld.com/p.w.stephenson/