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

Re: Probabilistic crash on zsh 5.9 on x86_64



> On 11/04/2023 17:29 Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> This indicates something is wrong with the reference counting:
> it shouldn't be possible for a shell code chunk to be visible
> to the user without it being marked as having at least one reference.

This should reliably pick up the problem, though it needs tracing back
to where the function is set up.

It was crashing 100% for me, too, and this is the only time I see this debug
message, so I think this is safe to commit and should give us a heads up
on other cases.

diff --git a/Src/exec.c b/Src/exec.c
index 3b3d1235e..49c196bfd 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -5942,6 +5942,8 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
 	funcsave->fstack.filename = getshfuncfile(shfunc);
 
 	prog = shfunc->funcdef;
+	DPUTS1(!prog->nref, "function definition %s has zero reference count",
+	       (fname && *fname) ? fname : "<anon>");
 	if (prog->flags & EF_RUN) {
 	    Shfunc shf;
 
pws




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