Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh exits suddenly.



"Bart Schaefer" wrote:
> On Jun 23, 11:45pm, Tanaka Akira wrote:
> } Subject: zsh exits suddenly.
> }
> } I have a trouble that zsh exits as following.
> } 
> } carbon% ls <^D>
> } zsh: do you wish to see all 848 possibilities? <^C>n
> } carbon% ls <^M>
> } akr@carbon% 
> 
> I finally figured out where that's happening -- it's in ingetc(), which
> is called from the SIGINT handler() via inerrflush().  However, I still
> don't know how to fix the problem.

You were right, the problem is more general than the one I fixed in
http://www.zsh.org/mla/workers-1998/msg00430.html .  How about this?
It says 'don't flush input if there aren't any characters to flush'.
It's hard to see how that can be wrong, since ingetc() always fetches
new data a line at a time.  It seems to work.

I think setting lexstop to 0 in the signal code is too drastic:  it
should never have got to 1 in the first place.

More technical notes:

I can't be absolutely sure if all that lastc stuff is really needed.
It means, of course, that if there is more than one line in the
buffer, only the current one is flushed.  Is this the right behaviour?
As you can see from the 'strin' test, if the data being read is a
single string (e.g. from a $(...) substitution) it dumps the whole lot
anyway.  Before I rewrote the input stuff, everything was shoved onto
a single string, so it was harder to tell when you had to stop
flushing it: I wimped out on removing the lastc stuff since I wrongly
thought it wasn't doing any harm.  Maybe I'll experiment here with
eliminating all the lastc nonsense and just testing inbufct.  The
comment in inerrflush() may be a red herring, it dates from before the
new code.

*** Src/input.c.lastc	Wed Jun 24 10:24:24 1998
--- Src/input.c	Wed Jun 24 10:32:39 1998
***************
*** 427,433 ****
       * it is only used in the history code, where that is the only
       * completely safe way of discarding input.
       */
!     while ((strin || lastc != '\n') && !lexstop)
  	ingetc();
  }
  
--- 427,433 ----
       * it is only used in the history code, where that is the only
       * completely safe way of discarding input.
       */
!     while ((strin || lastc != '\n') && !lexstop && inbufct)
  	ingetc();
  }
  
-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 50 844536
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author