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

PATCH: pws-25: eval bug



The eval builtin didn't save and restore the lexical state (really the
history state, but they're bound up together).  This showed up when I added
an eval to insert-files, which fixed the problem with parentheses I
mentioned yesterday, but caused the curious side-effect that although the
function seemed to run OK, hitting return on the generated command line
behaved as if it had got EOF.  This was because stophist was set to 2 to
read the eval string, and never got put back.  There were probably other
history effects, too.

I presume it's as simple as getting bin_eval() to use parse_string(), which
is there for that purpose, and does almost exactly what bin_eval() was
doing except that it restores the state properly.  Can anyone think of a
good reason why eval wasn't using parse_string() already?

Maybe this is needed in 3.0.6, although the problem would have to show up
in a different place.

--- Src/builtin.c.eval	Wed Jul  7 13:33:01 1999
+++ Src/builtin.c	Thu Jul  8 17:07:24 1999
@@ -3208,11 +3208,7 @@
 {
     List list;
 
-    inpush(zjoin(argv, ' '), 0, NULL);
-    strinbeg(0);
-    list = parse_list();
-    strinend();
-    inpop();
+    list = parse_string(zjoin(argv, ' '), 0);
     if (!list) {
 	errflag = 0;
 	return 1;

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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