zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: zsh heredoc crash
Date: Tue, 13 Sep 2016 09:29:51 +0100	[thread overview]
Message-ID: <20160913092951.7b222097@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20160912232522.GA16602@fujitsu.shahaf.local2>

On Mon, 12 Sep 2016 23:25:22 +0000
Daniel Shahaf <d.s@daniel.shahaf.name> 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);
 	}


      reply	other threads:[~2016-09-13  8:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAHAq8pEm1FHNvoUJUq2t86P-QKtMdT3uScDUGn-dCscJUGvWew@mail.gmail.com>
     [not found] ` <25855010.qczLe9GZ8n@kdudka-nb>
     [not found]   ` <20160909173515.4cb8392e@pwslap01u.europe.root.pri>
2016-09-10  1:02     ` Bart Schaefer
2016-09-11 18:02       ` Peter Stephenson
2016-09-12  1:13         ` Bart Schaefer
2016-09-12 23:25       ` Daniel Shahaf
2016-09-13  8:29         ` Peter Stephenson [this message]

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=20160913092951.7b222097@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).