zsh-workers
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi <hzoli@ny.frontiercomm.net>
To: schaefer@candle.brasslantern.com (Bart Schaefer)
Cc: zsh-workers@math.gatech.edu
Subject: Re: History bug still present in 3.0.3-test5
Date: Sat, 10 May 1997 23:14:50 -0400 (EDT)	[thread overview]
Message-ID: <199705110314.XAA03760@hzoli.home> (raw)
In-Reply-To: <970510104024.ZM9405@candle.brasslantern.com> from Bart Schaefer at "May 10, 97 10:40:24 am"

> I reported some while ago that zsh was failing to save history when it exits
> due to a dropped connection.
> 
> This is still happening.
> 
> To see it, run
> 
> 	xterm -e zsh -l
> 
> and then use the window manager to kill the xterm.  The $HISTFILE file will
> be truncated to zero size.

I cannot reproduce this Linux, but from the backtrace you sent earlier it
seems that the problem is that first zle notices that the input is lost and
calls zexit(), and while zexit is saving the history, zsh receives the HUP
signal.  It seems to be a kernel or xterm bug, since HUP should really come
before the input is lost.  Here is the fix.

Zoltan


*** Src/builtin.c	1997/05/06 05:12:29	3.1.2.14
--- Src/builtin.c	1997/05/11 02:59:42
***************
*** 2543,2562 ****
  void
  zexit(int val, int from_signal)
  {
      HEAPALLOC {
! 	if (isset(MONITOR)) {  /* if using job control                  */
! 	    if (!stopmsg) {
! 		scanjobs();    /* check if jobs need printing           */
! 		checkjobs();   /* check if any jobs are running/stopped */
! 		if (stopmsg) {
! 		    stopmsg = 2;
! 		    LASTALLOC_RETURN;
! 		}
! 	    } else {
! 		/* send SIGHUP to any jobs left running  */
! 		killrunjobs(from_signal);
  	    }
  	}
  	if (isset(RCS) && interact) {
  	    if (!nohistsave)
  		savehistfile(getsparam("HISTFILE"), 1, isset(APPENDHISTORY) ? 3 : 0);
--- 2543,2564 ----
  void
  zexit(int val, int from_signal)
  {
+     static int in_exit;
+ 
      HEAPALLOC {
! 	if (isset(MONITOR) && !stopmsg && !from_signal) {
! 	    scanjobs();    /* check if jobs need printing           */
! 	    checkjobs();   /* check if any jobs are running/stopped */
! 	    if (stopmsg) {
! 		stopmsg = 2;
! 		LASTALLOC_RETURN;
  	    }
  	}
+ 	if (in_exit++ && from_signal)
+ 	    LASTALLOC_RETURN;
+ 	if (isset(MONITOR))
+ 	    /* send SIGHUP to any jobs left running  */
+ 	    killrunjobs(from_signal);
  	if (isset(RCS) && interact) {
  	    if (!nohistsave)
  		savehistfile(getsparam("HISTFILE"), 1, isset(APPENDHISTORY) ? 3 : 0);


  reply	other threads:[~1997-05-11  3:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-10 17:40 Bart Schaefer
1997-05-11  3:14 ` Zoltan Hidvegi [this message]
1997-05-11  5:15   ` Bart Schaefer
1997-05-11  6:13     ` Zoltan Hidvegi

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=199705110314.XAA03760@hzoli.home \
    --to=hzoli@ny.frontiercomm.net \
    --cc=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@math.gatech.edu \
    /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).