Article View: comp.bugs.4bsd
Article #491non-interactive csh may mishandle children +FIX
From: Jeff Gilliam
Date: Thu, 18 Dec 1986 20:13
Date: Thu, 18 Dec 1986 20:13
62 lines
1908 bytes
1908 bytes
Index: bin/csh/sh.proc.c 4.3BSD
Description:
This report is a follow-up to an earlier report wherein I stated
that csh could mishandle signals. In fact, the real problem is
that a non-interactive csh will awaken when a child process stops
(e.g. because of SIGTTIN), then quickly realize it doesn't know
what to do next and exit.
Repeat-By:
Put the following shell script into the file 'snile' and make it
mode 755.
#! /bin/csh -f
cat
Then do the following:
% snile
^Z
Stopped
% bg
[1] snile &
[1] + Stopped (tty input) snile
% fg
snile
Stopped (tty input)
% jobs
%
Fix:
The problem is that csh waits for stopped children even when it
is running non-interactive. The following simple patch cures the
problem.
RCS file: RCS/sh.proc.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** /tmp/,RCSt1009068 Thu Dec 18 12:12:09 1986
--- /tmp/,RCSt2009068 Thu Dec 18 12:12:10 1986
***************
*** 37,43 ****
struct rusage ru;
loop:
! pid = wait3(&w, (setintr ? WNOHANG|WUNTRACED:WNOHANG), &ru);
if (pid <= 0) {
if (errno == EINTR) {
errno = 0;
--- 37,43 ----
struct rusage ru;
loop:
! pid = wait3(&w, ((setintr && intty) ? WNOHANG|WUNTRACED:WNOHANG), &ru);
if (pid <= 0) {
if (errno == EINTR) {
errno = 0;
--
Jeff Gilliam {ucbvax,pyramid,nsc}!voder!jeff
Technical Details
Message-ID:
<2825@voder.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!lll-lcc!pyramid!voder!jeffShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!lll-lcc!pyramid!voder!jeff From: jeff@voder.UUCP (Jeff Gilliam) Newsgroups: comp.bugs.4bsd Subject: non-interactive csh may mishandle children +FIX Message-ID: <2825@voder.UUCP> Date: Thu, 18-Dec-86 15:13:47 EST Article-I.D.: voder.2825 Posted: Thu Dec 18 15:13:47 1986 Date-Received: Fri, 19-Dec-86 00:26:28 EST Organization: National Semiconductor, Santa Clara Lines: 62