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

PATCH: Re: PS4 is hosed in -dev-22



Bart Schaefer wrote:

> I have
> 
> PS4='+%1N:%i%1(_.:%_.): '
> 
> This used to display e.g.
> 
> zagzig<3> echo bar
> +zsh-3.1.6-dev-20:3: echo bar
> 
> Now it displays:
> 
> zagzig<3> echo bar
> +                                                                                :3: echo bar
> 
> (There's a huge amount of whitespace between the `+' and the `:', in case
> your mail viewer has wrapped the line.)

My fault. doshfunc() didn't reset scriptname correctly.

Bye
 Sven

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.4
diff -u -r1.4 exec.c
--- Src/exec.c	2000/04/07 15:40:21	1.4
+++ Src/exec.c	2000/04/10 09:08:16
@@ -3249,7 +3249,7 @@
 {
     char **tab, **x, *oargv0;
     int oldzoptind, oldlastval, oldoptcind;
-    char saveopts[OPT_SIZE], *oldscriptname = NULL, *fname = dupstring(name);
+    char saveopts[OPT_SIZE], *oldscriptname = scriptname, *fname = dupstring(name);
     int obreaks;
     struct funcstack fstack;
 #ifdef MAX_FUNCTION_DEPTH
@@ -3267,10 +3267,8 @@
     starttrapscope();
 
     tab = pparams;
-    if (!(flags & PM_UNDEFINED)) {
-	oldscriptname = scriptname;
+    if (!(flags & PM_UNDEFINED))
 	scriptname = dupstring(name);
-    }
     oldzoptind = zoptind;
     zoptind = 1;
     oldoptcind = optcind;
@@ -3308,6 +3306,8 @@
     if(++funcdepth > MAX_FUNCTION_DEPTH)
     {
         zerr("maximum nested function level reached", NULL, 0);
+	scriptname = oldscriptname;
+	popheap();
 	return;
     }
 #endif
@@ -3328,6 +3328,7 @@
 	    if (!noreturnval)
 		lastval = 1;
 	    popheap();
+	    scriptname = oldscriptname;
 	    return;
 	}
 	prog = shf->funcdef;
@@ -3349,8 +3350,7 @@
     pparams = tab;
     optcind = oldoptcind;
     zoptind = oldzoptind;
-    if (oldscriptname)
-	scriptname = oldscriptname;
+    scriptname = oldscriptname;
 
     if (isset(LOCALOPTIONS)) {
 	/* restore all shell options except PRIVILEGED and RESTRICTED */

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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