Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!dptcdc!sickkids!mark From: mark@sickkids.UUCP (Mark Bartelt) Newsgroups: comp.bugs.4bsd Subject: /bin/sh loops if SIGSEGV ignored Message-ID: <304@sickkids.UUCP> Date: 26 Jul 89 13:38:59 GMT Reply-To: mark@sickkids.UUCP (Mark Bartelt) Organization: Hospital for Sick Children, Toronto Lines: 39 Problem: A shell spawned as a subprocess of a process that ignores SIGSEGV tends to get into a state in which it loops forever. For example, running the program ... /* x.c */ #include main() { signal(SIGSEGV,SIG_IGN); system("date"); } ... results in the following: PID TT STAT TIME COMMAND 26027 01 I 0:00 x 26028 01 I 0:00 sh -c date 26029 01 R 6:54 sh -c date --------------- Fix: In fault.c/getsig(), change IF trapflg[i=n]&SIGMOD ORF ignsig(i)==0 to IF trapflg[i=n]&SIGMOD ORF ignsig(i)==0 ORF i==MEMF It would probably also be wise to make the shell disallow attempts to trap SIGSEGV. In xec.c/execute(), eight lines down from "case SYSTRAP:", change IF (i=stoi(*com))>=MAXTRAP ORF i=MAXTRAP ORF i