zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Subject: Re: [BUG] REPORTTIME parsed as 0 with error in zle widget
Date: Mon, 12 Feb 2018 20:28:37 +0000	[thread overview]
Message-ID: <20180212202837.73d3f355@ntlworld.com> (raw)
In-Reply-To: <6de993f2-b9ab-19ba-fa2c-417377a4e6f8@thequod.de>

On Mon, 12 Feb 2018 10:05:08 +0100
Daniel Hahler <genml+zsh-workers@thequod.de> wrote:
> Given the following zle widget:
> getintvalue in should_report_time returns 0, although getstrvalue(v) is "5"!
> This is caused by errflag being set in matheval, which makes it return 0!
> And this gets caused by "exit 130" in __fsel.

This is probably too deep in jobs.c for anyone to have noticed it needed
protection like a lot of other functions already have.

pws

diff --git a/Src/jobs.c b/Src/jobs.c
index fc5bfac..503618f 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -925,6 +925,7 @@ should_report_time(Job j)
     struct value vbuf;
     Value v;
     char *s = "REPORTTIME";
+    int save_errflag = errflag;
     zlong reporttime = -1;
 #ifdef HAVE_GETRUSAGE
     char *sm = "REPORTMEMORY";
@@ -936,12 +937,14 @@ should_report_time(Job j)
 	return 1;
 
     queue_signals();
+    errflag = 0;
     if ((v = getvalue(&vbuf, &s, 0)))
 	reporttime = getintvalue(v);
 #ifdef HAVE_GETRUSAGE
     if ((v = getvalue(&vbuf, &sm, 0)))
 	reportmemory = getintvalue(v);
 #endif
+    errflag = save_errflag;
     unqueue_signals();
     if (reporttime < 0
 #ifdef HAVE_GETRUSAGE


      reply	other threads:[~2018-02-12 20:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12  9:05 Daniel Hahler
2018-02-12 20:28 ` 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=20180212202837.73d3f355@ntlworld.com \
    --to=p.w.stephenson@ntlworld.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).