zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: [PATCH] ? Parse error does not always set $? (Was: Bug? Output not flushed?)
Date: Fri, 15 Sep 2023 15:22:17 -0700	[thread overview]
Message-ID: <CAH+w=7YM0wKJMo4A8BnA=12QMcdQw3sBa+30Rj7vp3Q+WA2ZcA@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7ZiU+YY46hAVhR_8MoUmN6Mnxk8TFf9S3dgg_wkR16ajQ@mail.gmail.com>

On Fri, Sep 15, 2023 at 10:30 AM Bart Schaefer
<schaefer@brasslantern.com> wrote:
>
> Unless something is actually aborting the $(...)

Ah, part of the problem is upstream.

Is there any reason parse_string() should be discarding errflag?  All
tests still pass with this change:

diff --git a/Src/exec.c b/Src/exec.c
index 3a8b3e951..f6902fd39 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -286,6 +286,7 @@ parse_string(char *s, int reset_lineno)
 {
     Eprog p;
     zlong oldlineno;
+    int xerrflag;

     zcontext_save();
     inpush(s, INP_LINENO, NULL);
@@ -299,7 +300,9 @@ parse_string(char *s, int reset_lineno)
     lastval = 1;
     strinend();
     inpop();
+    xerrflag = errflag;
     zcontext_restore();
+    errflag = xerrflag;
     return p;
 }

That's not the only thing that was needed for the original nofork
problem, but the rest isn't relevant here.


  reply	other threads:[~2023-09-15 22:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 16:56 Bug? Output not flushed? Bart Schaefer
2023-09-15 17:05 ` Mikael Magnusson
2023-09-15 17:30   ` Bart Schaefer
2023-09-15 22:22     ` Bart Schaefer [this message]
2023-09-16  1:20       ` [PATCH] ? Parse error does not always set $? (Was: Bug? Output not flushed?) 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='CAH+w=7YM0wKJMo4A8BnA=12QMcdQw3sBa+30Rj7vp3Q+WA2ZcA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=mikachu@gmail.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).