about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2024-10-16 13:07:56 -0700
committerBart Schaefer <schaefer@zsh.org>2024-10-16 13:07:56 -0700
commitac1fd06d7ce073c86f00d50fd74464bcb5194e97 (patch)
tree12eef5fbf0290515a07f316dcf6d108de64f6b0f
parent383526da422cf1c962d9be7e9e6ac166e226bf2b (diff)
downloadzsh-ac1fd06d7ce073c86f00d50fd74464bcb5194e97.tar.gz
zsh-ac1fd06d7ce073c86f00d50fd74464bcb5194e97.tar.xz
zsh-ac1fd06d7ce073c86f00d50fd74464bcb5194e97.zip
53146: flags cannot be copied from an undefined function (cf. ca6f4466)
-rw-r--r--ChangeLog5
-rw-r--r--Src/exec.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a2b9eadae..977e25159 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-10-16  Bart Schaefer  <schaefer@toltec-ubuntu>
+
+	* 53146: Src/exec.c: trace flags cannot be copied from an
+	undefined function (cf. workers/45131)
+
 2024-09-02  Jun-ichi Takimoto  <takimoto-j@kba.biglobe.ne.jp>
 
 	* 53134: configure.ac: use -undefined dynamic_lookup on recent macOS
diff --git a/Src/exec.c b/Src/exec.c
index 8aa7466f5..bc07e8c39 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -5504,7 +5504,8 @@ execfuncdef(Estate state, Eprog redir_prog)
 	    if (funcstack && funcstack->tp == FS_FUNC &&
 		    !strcmp(s, funcstack->name)) {
 		Shfunc old = ((Shfunc)shfunctab->getnode(shfunctab, s));
-		shf->node.flags |= old->node.flags & (PM_TAGGED|PM_TAGGED_LOCAL);
+		if (old)
+		    shf->node.flags |= old->node.flags & (PM_TAGGED|PM_TAGGED_LOCAL);
 	    }
 	    shfunctab->addnode(shfunctab, ztrdup(s), shf);
 	}