about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-06-10 17:37:02 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-06-13 08:53:18 +0000
commit7badf262c1a33c8c5f7ee8ccc152733fcb5a05f7 (patch)
tree980a039f4f16eb0cb0386bce202ae8c2ffff975d /Src/exec.c
parentaa160fc8e962c2f6df62c62d67e366644457966c (diff)
downloadzsh-7badf262c1a33c8c5f7ee8ccc152733fcb5a05f7.tar.gz
zsh-7badf262c1a33c8c5f7ee8ccc152733fcb5a05f7.tar.xz
zsh-7badf262c1a33c8c5f7ee8ccc152733fcb5a05f7.zip
38653 + 38657: 'functions -T' tracing: recurse into anonymous functions.
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 2dcd5bcf5..515406f33 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4615,6 +4615,8 @@ exectime(Estate state, UNUSED(int do_exec))
 
 /* Define a shell function */
 
+static const char *const ANONYMOUS_FUNCTION_NAME = "(anon)";
+
 /**/
 static int
 execfuncdef(Estate state, Eprog redir_prog)
@@ -4732,7 +4734,7 @@ execfuncdef(Estate state, Eprog redir_prog)
 
 	    if (!args)
 		args = newlinklist();
-	    shf->node.nam = "(anon)";
+	    shf->node.nam = (char *) ANONYMOUS_FUNCTION_NAME;
 	    pushnode(args, shf->node.nam);
 
 	    execshfunc(shf, args);
@@ -5165,8 +5167,12 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
 
 	if (flags & (PM_TAGGED|PM_TAGGED_LOCAL))
 	    opts[XTRACE] = 1;
-	else if (oflags & PM_TAGGED_LOCAL)
-	    opts[XTRACE] = 0;
+	else if (oflags & PM_TAGGED_LOCAL) {
+	    if (shfunc->node.nam == ANONYMOUS_FUNCTION_NAME /* pointer comparison */)
+		flags |= PM_TAGGED_LOCAL;
+	    else
+		opts[XTRACE] = 0;
+	}
 	ooflags = oflags;
 	/*
 	 * oflags is static, because we compare it on the next recursive