Date: Sat, 7 Feb 1998 06:28:44 +1100 From: Bruce Evans <bde@zeta.org.au> To: cracauer@FreeBSD.ORG, cvs-all@FreeBSD.ORG, cvs-bin@FreeBSD.ORG, cvs-committers@FreeBSD.ORG Subject: Re: cvs commit: src/bin/sh jobs.c Message-ID: <199802061928.GAA07506@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
> Modified files: > bin/sh jobs.c > Log: > Fix handling of SIGINT/SIGQUIT for foreground subprocesses. Most > urgent need is when you run sh around a program that intentionally > uses SIGQUIT/SIGINT for asynchronous events, i.e. $EDITOR started from > system(2), like many mailers do. This fixes PR bin/1206 and possibly > bin/4241. > > The solution committed has been tested for a large number of possible > cases (see recent discussion on cvs-committers). I completed a make > world, made sure 'make world' is interruptable and used the changed > /bin/sh as a login shell all day, including job control and using > SIGQUIT-catching programs (to write this message :-). > > PR: bin/1206 > Reviewed by: discussion on cvs-commiters I thought we were still discussing it. I didn't like it before, and like it less now. The committed version has the following bugs: 1) SIGINT/SIGQUIT are not restored after fork failure. 2) SIGINT/SIGQUIT are always reset to SIG_DFL in the child. This is wrong if these signals are ignored on entry to the shell. 3) SIGTERM apparently needs to be handled like SIGINT/SIGQUIT. bash seems to handle it like that. I'm testing the following fix: diff -c2 trap.c~ trap.c *** trap.c~ Tue Nov 11 18:15:35 1997 --- trap.c Fri Feb 6 23:51:08 1998 *************** *** 223,228 **** switch (signo) { case SIGINT: ! if (iflag) ! action = S_CATCH; break; case SIGQUIT: --- 223,227 ---- switch (signo) { case SIGINT: ! action = S_CATCH; break; case SIGQUIT: *************** *** 239,242 **** --- 238,243 ---- if (iflag) action = S_IGN; + else + action = S_CATCH; break; #if JOBS *************** *** 402,406 **** int on; { ! static int is_interactive = 0; if (on == is_interactive) --- 403,407 ---- int on; { ! static int is_interactive = -1; if (on == is_interactive) Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802061928.GAA07506>