From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3873 invoked from network); 17 Feb 2003 11:38:46 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 17 Feb 2003 11:38:46 -0000 Received: (qmail 22556 invoked by alias); 17 Feb 2003 11:38:38 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18251 Received: (qmail 22549 invoked from network); 17 Feb 2003 11:38:37 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 17 Feb 2003 11:38:37 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.183.235] by sunsite.dk (MessageWall 1.0.8) with SMTP; 17 Feb 2003 11:38:37 -0000 Received: from exchange01.csr.com (unverified) by (Content Technologies SMTPRS 4.2.1) with ESMTP id ; Mon, 17 Feb 2003 11:45:23 +0000 Received: from csr.com (tinky-winky.csr.com [192.168.144.127]) by exchange01.csr.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id DQ47M0P3; Mon, 17 Feb 2003 11:39:04 -0000 To: Mikael Magnusson , zsh-workers@sunsite.dk Subject: Re: Segfault in zsh 4.1.0-dev-7 using select In-reply-to: "Mikael Magnusson"'s message of "Sun, 16 Feb 2003 16:01:15 +0100." Date: Mon, 17 Feb 2003 11:38:36 +0000 Message-ID: <18418.1045481916@csr.com> From: Peter Stephenson Mikael Magnusson wrote: > Hi, this command makes zsh segfault for me, using version 4.1.0-dev-7 > (also tried in -dev-6, and it works fine in 4.0.4 and 4.0.6) > select a in foo bar;do echo $a;done Thanks for spotting this, it's entirely my fault. When I added `for vara varb in val1a val1b ...' I tried not to screw up select, but did anyway (and obviously didn't test it). The new syntax isn't appropriate for select. I've also made select accept an EOF from the keyboard instead of printing `use 'exit' to exit', which doesn't make any sense except at the main prompt. This ought really to be an argument to zleread(). Index: Src/loop.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/loop.c,v retrieving revision 1.8 diff -u -r1.8 loop.c --- Src/loop.c 25 Feb 2002 09:21:14 -0000 1.8 +++ Src/loop.c 17 Feb 2003 11:34:34 -0000 @@ -202,7 +202,7 @@ wordcode code = state->pc[-1]; char *str, *s, *name; LinkNode n; - int i, usezle; + int i, usezle, oignoreeof = opts[IGNOREEOF]; FILE *inp; size_t more; LinkList args; @@ -238,6 +238,7 @@ inp = fdopen(dup(usezle ? SHTTY : 0), "r"); more = selectlist(args, 0); loop = state->pc; + opts[IGNOREEOF] = 0; for (;;) { for (;;) { if (empty(bufstack)) { @@ -301,6 +302,7 @@ fclose(inp); loops--; state->pc = end; + opts[IGNOREEOF] = oignoreeof; return lastval; } Index: Src/parse.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/parse.c,v retrieving revision 1.39 diff -u -r1.39 parse.c --- Src/parse.c 6 Oct 2002 18:38:14 -0000 1.39 +++ Src/parse.c 17 Feb 2003 11:34:34 -0000 @@ -923,18 +923,19 @@ yylex(); type = WC_FOR_COND; } else { - int np, n, posix_in, ona = noaliases, onc = nocorrect; + int np = 0, n, posix_in, ona = noaliases, onc = nocorrect; infor = 0; if (tok != STRING || !isident(tokstr)) YYERRORV(oecused); - np = ecadd(0); + if (!sel) + np = ecadd(0); n = 0; incmdpos = 1; noaliases = nocorrect = 1; for (;;) { n++; ecstr(tokstr); - yylex(); + yylex(); if (tok != STRING || !strcmp(tokstr, "in") || sel) break; if (!isident(tokstr) || errflag) @@ -946,7 +947,8 @@ } noaliases = ona; nocorrect = onc; - ecbuf[np] = n; + if (!sel) + ecbuf[np] = n; posix_in = isnewlin; while (isnewlin) yylex(); -- 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. **********************************************************************