Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Segfault in zsh 4.1.0-dev-7 using select
- X-seq: zsh-workers 18251
- From: Peter Stephenson <pws@xxxxxxx>
- To: Mikael Magnusson <mmikael@xxxxxxxxx>, zsh-workers@xxxxxxxxxx
- Subject: Re: Segfault in zsh 4.1.0-dev-7 using select
- Date: Mon, 17 Feb 2003 11:38:36 +0000
- In-reply-to: "Mikael Magnusson"'s message of "Sun, 16 Feb 2003 16:01:15 +0100." <Pine.LNX.4.52.0302161558200.23400@localhost>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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 <pws@xxxxxxx> 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.
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author