From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16349 invoked from network); 10 Nov 1999 08:20:01 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 10 Nov 1999 08:20:01 -0000 Received: (qmail 10371 invoked by alias); 10 Nov 1999 08:19:55 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8607 Received: (qmail 10364 invoked from network); 10 Nov 1999 08:19:52 -0000 Date: Wed, 10 Nov 1999 09:19:46 +0100 (MET) Message-Id: <199911100819.JAA27910@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk Subject: suggested PATCH 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