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

Re: Test Failures from latest CVS



On Sat, 4 Sep 2004, Bart Schaefer wrote:

> PWS got something subtly wrong in zsh-workers/20308.  I haven't figured
> out what yet.  Maybe he'll beat me to it.

The scriptname has to be changed before the string to be eval'd is parsed. 
Peter tried (or so I presume) to fix a long-standing bug that scriptname 
would not be restored properly on a parse error, by delaying the change 
rather than by explicitly restoring; but also neglected to restore ineval 
to its previous state in the same circumstance.  (Is there a reason not to 
assign lastval in that case also?  It could simplify the code structure.)

Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.123
diff -u -r1.123 builtin.c
--- Src/builtin.c	3 Sep 2004 09:47:49 -0000	1.123
+++ Src/builtin.c	4 Sep 2004 16:27:03 -0000
@@ -4235,16 +4235,18 @@
      * we use a special script name to indicate the special line number.
      */
     ineval = !isset(EVALLINENO);
+    if (!ineval)
+	scriptname = "(eval)";
 
     prog = parse_string(zjoin(argv, ' ', 1));
     if (!prog) {
 	errflag = 0;
+        scriptname = oscriptname;
+        ineval = oineval;
 	return 1;
     }
 
     lastval = 0;
-    if (!ineval)
-	scriptname = "(eval)";
 
     execode(prog, 1, 0);
 
@@ -4253,8 +4255,7 @@
 	errflag = 0;
     }
 
-    if (!ineval)
-	scriptname = oscriptname;
+    scriptname = oscriptname;
     ineval = oineval;
 
     return lastval;



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