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

Re: zsh heredoc crash



On Mon, 12 Sep 2016 23:25:22 +0000
Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> There seems to be a logic error in gethere():
> 
> 	if (!errflag) {
> 	    /* Retain any user interrupt error */
> 	    errflag = ef | (errflag & ERRFLAG_INT);
> 	}

I think the intention is the following:

- If there's a (synchronous) error from parsestr(), return that.
- If there isn't, keep the previous error status, but also keep
any (asynchronous) interrupt flag.

pws

diff --git a/Src/exec.c b/Src/exec.c
index 2e251b9..cfd633a 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4034,7 +4034,7 @@ gethere(char **strp, int typ)
 
 	parsestr(&buf);
 
-	if (!errflag) {
+	if (!(errflag & ERRFLAG_ERROR)) {
 	    /* Retain any user interrupt error */
 	    errflag = ef | (errflag & ERRFLAG_INT);
 	}



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