Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: Couple of bugs in 3.1.9-dev-3



Geoff Wing wrote:

> coral% zsh-3.1.9-dev-3 -f
> % time | time
> unknown word code in gettext2()
> unknown word code in gettext2()
> unknown word code in gettext2()
> unknown word code in gettext2()
> unknown word code in gettext2()
> % time | echo
> zsh: 14281 segmentation fault (core dumped)  zsh -f
> coral% zsh-3.1.9-dev-3 -f
> % time | time; echo
> zsh: 14281 segmentation fault (core dumped)  zsh -f

Uh, oh. Wrong parsing of `time' withoout a command to measure.

Bye
 Sven

Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.11
diff -u -r1.11 parse.c
--- Src/parse.c	2000/07/19 20:40:18	1.11
+++ Src/parse.c	2000/07/21 07:48:40
@@ -1389,9 +1389,13 @@
 
     p = ecadd(0);
     ecadd(0);
-    f = par_sublist2(&c);
-    ecbuf[p] = WCB_TIMED((p + 1 == ecused) ? WC_TIMED_EMPTY : WC_TIMED_PIPE);
-    set_sublist_code(p + 1, WC_SUBLIST_END, f, ecused - 2 - p, c);
+    if ((f = par_sublist2(&c)) < 0) {
+	ecused--;
+	ecbuf[p] = WCB_TIMED(WC_TIMED_EMPTY);
+    } else {
+	ecbuf[p] = WCB_TIMED(WC_TIMED_PIPE);
+	set_sublist_code(p + 1, WC_SUBLIST_END, f, ecused - 2 - p, c);
+    }
 }
 
 /*

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author