about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <danielsh@apache.org>2020-01-26 01:17:00 +0000
committerDaniel Shahaf <danielsh@apache.org>2020-01-29 09:02:49 +0000
commit581585dfc66e2bb18434cdd1ad2f5899b12a86dd (patch)
tree8084b9d252ecd3a0cbfaf7da58c770a2158a8687
parent8dab5bc03726168356f76c708919ed011adbaf95 (diff)
downloadzsh-581585dfc66e2bb18434cdd1ad2f5899b12a86dd.tar.gz
zsh-581585dfc66e2bb18434cdd1ad2f5899b12a86dd.tar.xz
zsh-581585dfc66e2bb18434cdd1ad2f5899b12a86dd.zip
45343: Queue signals around arithmetic evaluations
The queueing added in execarith() in 45083 is reverted since the callee
does this now.
-rw-r--r--ChangeLog3
-rw-r--r--Src/exec.c3
-rw-r--r--Src/math.c15
3 files changed, 14 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index f15cfbe56..95a94db07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2020-01-29  Daniel Shahaf  <danielsh@apache.org>
 
+	* 45343: Src/exec.c, Src/math.c: Queue signals around arithmetic
+	evaluations
+
 	* 45344: INSTALL: Document where third-party completion functions
 	should be installed.
 
diff --git a/Src/exec.c b/Src/exec.c
index fac095d64..50027654a 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -5101,7 +5101,6 @@ execarith(Estate state, UNUSED(int do_exec))
     mnumber val = zero_mnumber;
     int htok = 0;
 
-    queue_signals();
     if (isset(XTRACE)) {
 	printprompt4();
 	fprintf(xtrerr, "((");
@@ -5121,8 +5120,6 @@ execarith(Estate state, UNUSED(int do_exec))
 	fprintf(xtrerr, " ))\n");
 	fflush(xtrerr);
     }
-    unqueue_signals();
-
     if (errflag) {
 	errflag &= ~ERRFLAG_ERROR;
 	return 2;
diff --git a/Src/math.c b/Src/math.c
index a38770073..905b910ec 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -1133,8 +1133,7 @@ notzero(mnumber a)
 
 /* macro to pop three values off the value stack */
 
-/**/
-void
+static void
 op(int what)
 {
     mnumber a, b, c, *spval;
@@ -1569,14 +1568,19 @@ mathparse(int pc)
 
     if (errflag)
 	return;
+    queue_signals();
     mtok = zzlex();
     /* Handle empty input */
-    if (pc == TOPPREC && mtok == EOI)
+    if (pc == TOPPREC && mtok == EOI) {
+	unqueue_signals();
 	return;
+    }
     checkunary(mtok, optr);
     while (prec[mtok] <= pc) {
-	if (errflag)
+	if (errflag) {
+	    unqueue_signals();
 	    return;
+	}
 	switch (mtok) {
 	case NUM:
 	    push(yyval, NULL, 0);
@@ -1595,6 +1599,7 @@ mathparse(int pc)
 	    if (mtok != M_OUTPAR) {
 		if (!errflag)
 		    zerr("bad math expression: ')' expected");
+		unqueue_signals();
 		return;
 	    }
 	    break;
@@ -1613,6 +1618,7 @@ mathparse(int pc)
 	    if (mtok != COLON) {
 		if (!errflag)
 		    zerr("bad math expression: ':' expected");
+		unqueue_signals();
 		return;
 	    }
 	    if (q)
@@ -1636,4 +1642,5 @@ mathparse(int pc)
 	mtok = zzlex();
 	checkunary(mtok, optr);
     }
+    unqueue_signals();
 }