[net.sources.bugs] Bug fix to ispell

cudcv@warwick.ac.uk (Rob McMahon) (01/19/87)

<munch>

DESCRIPTION
        ispell may loop endlessly if fired off in the background (or if the
        fixes from pedz@bobcat aren't installed and you aren't on a VAX).

REPEAT BY
        ispell file &
        ps
        ps

FIX
        The masks used in the sigsetmasks in term.c are wrong, they should be
        (1<<(sig-1)), not just (1<<sig).  Hence SIGTTOU is blocked just before
        the kill(0, SIGTTOU).  Context diffs follow, apply to term.c with
        patch.  (these are after applying the mods from pedz@bobkat - although
        I don't think they conflict, line numbers may vary.  You really ought
        to at least install the short->int for TIOCGPGRP though).

RCS file: term.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -c -r1.2 -r1.3
*** /tmp/,RCSt1029193	Mon Jan 19 09:49:15 1987
--- /tmp/,RCSt2029193	Mon Jan 19 09:49:16 1987
***************
*** 10,15
  #include <signal.h>
  #include "ispell.h"

  int putch();

  erase ()

--- 10,19 -----
  #include <signal.h>
  #include "ispell.h"

+ #ifndef	sigmask
+ #define	sigmask(s)	(1 << ((s)-1))
+ #endif
+
  int putch();

  erase ()
***************
*** 65,71
  	extern short ospeed;

  retry:
! 	sigsetmask(1<<SIGTSTP | 1<<SIGTTIN | 1<<SIGTTOU);
  	if (ioctl(0, TIOCGPGRP, &tpgrp) != 0) {
  		fprintf (stderr, "Can't deal with non interactive use yet.\n");
  		exit (1);

--- 69,75 -----
  	extern short ospeed;

  retry:
! 	sigsetmask(sigmask(SIGTSTP) | sigmask(SIGTTIN) | sigmask(SIGTTOU));
  	if (ioctl(0, TIOCGPGRP, &tpgrp) != 0) {
  		fprintf (stderr, "Can't deal with non interactive use yet.\n");
  		exit (1);
***************
*** 71,77
  		exit (1);
  	}
  	if (tpgrp != getpgrp(0)) { /* not in foreground */
! 		sigsetmask(1<<SIGTSTP | 1<<SIGTTIN);
  		signal(SIGTTOU, SIG_DFL);
  		kill(0, SIGTTOU);
  		/* job stops here waiting for SIGCONT */

--- 75,81 -----
  		exit (1);
  	}
  	if (tpgrp != getpgrp(0)) { /* not in foreground */
! 		sigsetmask(sigmask(SIGTSTP) | sigmask(SIGTTIN));
  		signal(SIGTTOU, SIG_DFL);
  		kill(0, SIGTTOU);
  		/* job stops here waiting for SIGCONT */

--
-- 
UUCP:   ...!mcvax!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv@uk.ac.warwick.daisy       ARPA:   cudcv@daisy.warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England