zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] queueing_enabled grows infinitely when in .recursive-edit
Date: Mon, 03 Oct 2016 11:18:40 +0100	[thread overview]
Message-ID: <20161003111840.3e5081f0@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <161002162145.ZM22574@torch.brasslantern.com>

On Sun, 02 Oct 2016 16:21:45 -0700
Bart Schaefer <schaefer@brasslantern.com> 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)


  parent reply	other threads:[~2016-10-03 10:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-02 19:00 Sebastian Gniazdowski
2016-10-02 19:02 ` Sebastian Gniazdowski
2016-10-02 23:21 ` Bart Schaefer
2016-10-03 10:00   ` Sebastian Gniazdowski
2016-10-03 10:18   ` Peter Stephenson [this message]
2016-10-03 11:55     ` Sebastian Gniazdowski
2016-10-03 15:49       ` Bart Schaefer
2016-10-03 16:43         ` Sebastian Gniazdowski
2016-10-03 18:11           ` Bart Schaefer
2016-10-05  5:56         ` Sebastian Gniazdowski
2016-10-05  6:03           ` Sebastian Gniazdowski
2016-10-03 15:20     ` Bart Schaefer
2016-10-03 16:07       ` Bart Schaefer
2016-10-03 16:33   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161003111840.3e5081f0@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).