[net.sources.bugs] Bug in MicroEMACS 3.7

jhma1@ukc.ac.uk (J.H.M.Aldridge) (08/19/86)

[]

If in MicroEMACS 3.7 you kill the special "[List]" buffer which holds
the buffer list (obtained by ^X^B) and afterwards ask for the buffer
list to be displayed then the program bombs out with "Segmentation
fault: core dumped" and the terminal is left in raw mode. 

I have fixed this by adding a check in the killbuffer() function (in the
file buffer.c) to test whether the buffer that is being deleted has the
BFINVS flag bit set.  If it does, then the buffer is not deleted. 

My fix is to alter the killbuffer function to include the following
extra two lines:

	...
		return (TRUE);
    +-------------------
    |	if(bp->b_flag & BFINVS)		/* Deal with special buffers	*/
    |		return (TRUE);		/* by doing nothing.		*/
    +-------------------
	return(zotbuf(bp));


-----
James Aldridge,			jhma1@ukc.UUCP
University of Kent,
Canterbury,			...!mcvax!ukc!jhma1
Kent,
U.K.

jhma1@ukc.ac.uk (J.H.M.Aldridge) (10/02/86)

There is a fproblem with MicroEMACS 3.7 (when run under 4.1 and 4.2 BSD
UNIX) which occurs if the editor is called by another program (e.g. 
mail) and you then want to suspend the job.  Currently, if you type
ESC-S (suspend-emacs) the editor will stop but a further ^Z will be
needed to suspend the calling process. 

The fix for this is to modify the bktoshell routine in the spawn.c file
so that instead of sending the SIGTSTP signal just to the current
process, the signal gets sent to all processes in the current process
group. 

The context diff between the two versions of spawn.c follow:


------------CUT---ALONG---DOTTED---LINE-----------
*** spawn.c.old	Thu Oct  2 21:16:44 1986
--- spawn.c	Thu Oct  2 21:19:06 1986
***************
*** 104,111
  
  bktoshell()		/* suspend MicroEMACS and wait to wake up */
  {
- 	int pid;
- 
  	vttidy();
  	pid = getpid();
  	kill(pid,SIGTSTP);

--- 104,109 -----
  
  bktoshell()		/* suspend MicroEMACS and wait to wake up */
  {
  	vttidy();
  	kill(0,SIGTSTP);	/* Suspend all processes in process group */
  }
***************
*** 107,114
  	int pid;
  
  	vttidy();
! 	pid = getpid();
! 	kill(pid,SIGTSTP);
  }
  
  rtfrmshell()

--- 105,111 -----
  bktoshell()		/* suspend MicroEMACS and wait to wake up */
  {
  	vttidy();
! 	kill(0,SIGTSTP);	/* Suspend all processes in process group */
  }
  
  rtfrmshell()


---
James Aldridge,                        jhma1@ukc.ac.uk
University of Kent at Canterbury,      ...!seismo!mcvax!ukc!jhma1
Canterbury,
Kent,
ENGLAND,
CT2 7NF

chris@umcp-cs.UUCP (Chris Torek) (10/08/86)

It should not be necessary to send SIGTSTP to your process group
after catching one.  (Note the word *should*.)  This is because
everyone in your process group should have received the same keyboard
signal already.  Each should handle the TSTP, then stop itself.

Note that there is a timing problem here as well, at least among
programs that alter and then restore the tty state.  For example,
suppose you run a program that sets the terminal to cbreak mode,
then that program runs another that sets the terminal to nl mode
(CR/LF mapping turned off).  Now you type ^Z.  Which program runs
first?  If it is the cbreak'er that runs first, it will restore
the mode properly, then stop; then the nl'er will run, and `restore'
the mode to cbreak.

Oops.

(There are many solutions, but I am not up to listing them now.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@mimsy.umd.edu