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

Re: [BUG] queueing_enabled grows infinitely when in .recursive-edit



On Sun, 02 Oct 2016 16:21:45 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> The third is that somewhere below execstring() from checksched(),
> the signal queueing level is being incremented but not decremented.

Here are some missing unqueue_signals() (this was quite boring, by the
way, just in case you were thinking "wow, wish I'd done that").  Most of
these look minor but the one in execpline() looks like it could be
hairy because most things in execpline() are hairy.  I think they're all
uncontroversial once you've seen them, but I could have slipped up as
there are quite a few.

pws

diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 27b78cd..e9bad1c 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -4865,6 +4865,7 @@ bin_compfiles(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
 	    }
 	    queue_signals();
 	    if (!(tmp = getaparam(args[1]))) {
+		unqueue_signals();
 		zwarnnam(nam, "unknown parameter: %s", args[1]);
 		return 0;
 	    }
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 0bdd82b..0b3b1fc 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1631,6 +1631,7 @@ bin_vared(char *name, char **args, Options ops, UNUSED(int func))
 	return 1;
     } else if (v) {
 	if (*s) {
+	    unqueue_signals();
 	    zwarnnam(name, "not an identifier: `%s'", args[0]);
 	    return 1;
 	}
diff --git a/Src/builtin.c b/Src/builtin.c
index 60dc07f..a274ff7 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1489,6 +1489,7 @@ bin_fc(char *nam, char **argv, Options ops, int func)
     }
 
     if (zleactive) {
+	unqueue_signals();
 	zwarnnam(nam, "no interactive history within ZLE");
 	return 1;
     }
@@ -2808,6 +2809,7 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
 	return 0;
     }
     if (off & PM_TIED) {
+	unqueue_signals();
 	zerrnam(name, "use unset to remove tied variables");
 	return 1;
     }
@@ -3138,6 +3140,7 @@ bin_functions(char *name, char **argv, Options ops, int func)
 	    queue_signals();
 	    for (q = mathfuncs; q; q = q->next) {
 		if (!strcmp(q->name, funcname)) {
+		    unqueue_signals();
 		    zwarnnam(name, "-M %s: function already exists",
 			     funcname);
 		    zsfree(p->name);
diff --git a/Src/exec.c b/Src/exec.c
index a429428..9890286 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1795,6 +1795,8 @@ execpline(Estate state, wordcode slcode, int how, int last1)
 		deletejob(jn, 0);
 	    thisjob = pj;
 	}
+	else
+	    unqueue_signals();
 	if ((slflags & WC_SUBLIST_NOT) && !errflag)
 	    lastval = !lastval;
     }
@@ -5556,6 +5558,7 @@ runshfunc(Eprog prog, FuncWrap wrap, char *name)
 	if (!cont) {
 	    if (ou)
 		zfree(ou, ouu);
+	    unqueue_signals();
 	    return;
 	}
 	wrap = wrap->next;
diff --git a/Src/hist.c b/Src/hist.c
index 5fc40bd..eebd7dc 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -653,6 +653,7 @@ histsubchar(int c)
 		(c == '}' ||  c == ';' || c == '\'' || c == '"' || c == '`')) {
 	      /* Neither event nor word designator, no expansion */
 	      safeinungetc(c);
+	      unqueue_signals();
 	      return bangchar;
 	    }
 	    *ptr = 0;
diff --git a/Src/init.c b/Src/init.c
index 3dea179..c12043b 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -1442,8 +1442,10 @@ sourcehome(char *s)
     queue_signals();
     if (EMULATION(EMULATE_SH|EMULATE_KSH) || !(h = getsparam_u("ZDOTDIR"))) {
 	h = home;
-	if (!h)
+	if (!h) {
+	    unqueue_signals();
 	    return;
+	}
     }
 
     {
diff --git a/Src/mem.c b/Src/mem.c
index 021dad5..db311ef 100644
--- a/Src/mem.c
+++ b/Src/mem.c
@@ -903,11 +903,15 @@ memory_validate(Heapid heap_id)
 
     queue_signals();
     for (h = heaps; h; h = h->next) {
-	if (h->heap_id == heap_id)
+	if (h->heap_id == heap_id) {
+	    unqueue_signals();
 	    return 0;
+	}
 	for (hs = heaps->sp; hs; hs = hs->next) {
-	    if (hs->heap_id == heap_id)
+	    if (hs->heap_id == heap_id) {
+		unqueue_signals();
 		return 0;
+	    }
 	}
     }
 
diff --git a/Src/module.c b/Src/module.c
index 46a7d77..41f142a 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -2242,6 +2242,7 @@ load_module(char const *name, Feature_enables enablesarr, int silent)
 	return 0;
     }
     if (m->node.flags & MOD_BUSY) {
+	unqueue_signals();
 	zerr("circular dependencies for module ;%s", name);
 	return 1;
     }
diff --git a/Src/params.c b/Src/params.c
index e115102..1418021 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -2803,6 +2803,7 @@ assignsparam(char *s, char *val, int flags)
 		zerr("read-only variable: %s", v->pm->node.nam);
 		*ss = '[';
 		zsfree(val);
+		unqueue_signals();
 		return NULL;
 	    }
 	    flags &= ~ASSPM_WARN_CREATE;
@@ -3117,6 +3118,7 @@ setnparam(char *s, mnumber val)
 	if (!(v = getvalue(&vbuf, &t, 1))) {
 	    DPUTS(!v, "BUG: value not found for new parameter");
 	    /* errflag |= ERRFLAG_ERROR; */
+	    unqueue_signals();
 	    return NULL;
 	}
 	if (!was_unset && isset(WARNCREATEGLOBAL) && locallevel > forklevel)
diff --git a/Src/prompt.c b/Src/prompt.c
index d4f3898..ee77c8b 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -491,8 +491,10 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
 		if (!arg)
 		    arg++;
 		queue_signals();
-		if (!(hostnam = getsparam("HOST")))
+		if (!(hostnam = getsparam("HOST"))) {
+		    unqueue_signals();
 		    break;
+		}
 		if (arg < 0) {
 		    for (ss = hostnam + strlen(hostnam); ss > hostnam; ss--)
 			if (ss[-1] == '.' && !++arg)



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