zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: suggested PATCH
Date: Wed, 10 Nov 1999 09:19:46 +0100 (MET)	[thread overview]
Message-ID: <199911100819.JAA27910@beta.informatik.hu-berlin.de> (raw)



I'm pretty sure I found a bug, I'm just not sure if the result was
intended (and I don't like it):

If you exit a shell with running jobs you get this `n jobs SIGHUPed'
message. Exiting is done in zexit(), which calls killrunjobs(), which
in turn prints that message using zerr() -- and that sets errflag=1.
Later, zexit() calls savehistfile(), that calls getiparam("SAVEHIST")
to get the number of lines that should be saved. That in turn uses
(vie getinvalue()) mathevali() to turn the parameter value into an
integer. And matheval() calls mathevall() which calls mathparse()
which -- now it comes! -- returns immediatly when errflag is set. This 
causes mathevall() to return some random value. In my case it was -4
and that meant that the history wasn't saved.

And I don't like having my history not saved just because the error
message about SIGHUPed jobs was printed.

So this patch makes the returned value in mathevall() be initialised
to zero, but it also makes errflag be reset in zexit(). It's that last 
part I'm not so sure about -- maybe you all like this history-saving-
avoidance?

Bye
 Sven

diff -u oldsrc/builtin.c Src/builtin.c
--- oldsrc/builtin.c	Mon Nov  8 11:23:25 1999
+++ Src/builtin.c	Wed Nov 10 09:02:32 1999
@@ -3209,9 +3209,11 @@
 	if (in_exit++ && from_signal) {
 	    LASTALLOC_RETURN;
 	}
-	if (isset(MONITOR))
+	if (isset(MONITOR)) {
 	    /* send SIGHUP to any jobs left running  */
 	    killrunjobs(from_signal);
+	    errflag = 0;
+	}
 	if (isset(RCS) && interact) {
 	    if (!nohistsave)
 		savehistfile(NULL, 1, HFILE_USE_OPTIONS);
diff -u oldsrc/math.c Src/math.c
--- oldsrc/math.c	Mon Nov  8 11:23:26 1999
+++ Src/math.c	Wed Nov 10 09:06:44 1999
@@ -876,6 +876,8 @@
     ptr = s;
     sp = -1;
     unary = 1;
+    stack[0].val.type = MN_INTEGER;
+    stack[0].val.u.l = 0;
     mathparse(prek);
     *ep = ptr;
     DPUTS(!errflag && sp,

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~1999-11-10  8:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-10  8:19 Sven Wischnowsky [this message]
1999-11-11  9:59 ` 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=199911100819.JAA27910@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).