From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18658 invoked by alias); 17 Oct 2012 19:20:44 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30735 Received: (qmail 26144 invoked from network); 17 Oct 2012 19:20:41 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: neutral (ns1.primenet.com.au: 209.85.215.171 is neither permitted nor denied by SPF record at ntlworld.com) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-proxyuser-ip:date:from:to:subject:message-id:in-reply-to :references:x-mailer:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=lv9eorddR47yYQBDKC71gl8/hr4EmfE9jQ8gSmaaHXU=; b=SD8zAdpYU+xJpoZuN+etWi/ZgmaJqlUiitzsqUpZY8dGzcOcO/LVwerLLO9axEMsn/ aHoMXPKg0ZVFU3aQaSzVY09gzfXB9qBkpG2qcyfDPNzI0jAjO+vnmPywAX4qpC+OilA0 PY/FtzEPpUP5A2gAgSMurRkzBE0Tyk267umi+LO3xvUlMMItifJdDcXUcelsjEW+yMd3 7ZZJM+s+cmFXvzbzCr/uRnZjOjLxgZuAq+FWJtF5ZjSkOyL2sLBR5F4seAU3uSIaBvu6 VBU1xqrd2+tMrJMhBfUA0eFilFcMGmYVKXOfHht5ajac0e3fZqkxn78O3qWqX0vYF8Os MCJA== X-ProxyUser-IP: 82.8.55.192 Date: Wed, 17 Oct 2012 20:20:30 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: Segfault in =( ) substitution Message-ID: <20121017202030.46014a7a@pws-pc.ntlworld.com> In-Reply-To: References: X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQlbxhWImkD9XrxDSSD6iVCyK2XqjziigYZVnm65N78Cb98ZSH1Wispi2AGjCtZBRuEEne6A On Sun, 14 Oct 2012 23:30:28 -0400 Vin Shelton wrote: > Starting very recently, I'm getting a core dump from this code: >... > [[ -n $pat1 ]] && diff1=( =(perl -p -e $pat1 < $file1) ) This should fix the crash, however the resulting code isn't very useful. The job created for the assignment finishes after the assigment finishes, so the contents of the array is a file that's already been deleted. I'm not really sure if there's anything sensible to be done about this. It might be possible to detect that the assignment is within some other structure, e.g. shell function, and associate it with that (maybe this used to happen by accident before), but in a top-level script or interactive shell there's no such job, so this doesn't generally work. Index: Src/parse.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/parse.c,v retrieving revision 1.92 diff -p -u -r1.92 parse.c --- Src/parse.c 11 Oct 2012 20:14:03 -0000 1.92 +++ Src/parse.c 17 Oct 2012 19:16:13 -0000 @@ -1610,6 +1610,11 @@ par_simple(int *complex, int nr) } else if (tok == ENVARRAY) { int oldcmdpos = incmdpos, n, type2; + /* + * We consider array setting complex because it can + * contain process substitutions, which need a valid job. + */ + *complex = c = 1; p = ecadd(0); incmdpos = 0; if ((type2 = strlen(tokstr) - 1) && tokstr[type2] == '+') { -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/