From owner-freebsd-questions Thu Apr 19 1: 1:52 2001 Delivered-To: freebsd-questions@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.13]) by hub.freebsd.org (Postfix) with SMTP id 9168937B424 for ; Thu, 19 Apr 2001 01:01:38 -0700 (PDT) (envelope-from roam@ringworld.nanolink.com) Received: (qmail 14674 invoked by uid 1000); 19 Apr 2001 07:59:57 -0000 Date: Thu, 19 Apr 2001 10:59:57 +0300 From: Peter Pentchev To: questions@FreeBSD.org Subject: Re: A real stupid-like sessions / group leaders / shells question Message-ID: <20010419105957.C3605@ringworld.oblivion.bg> References: <20010418210622.A2272@ringworld.oblivion.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010418210622.A2272@ringworld.oblivion.bg>; from roam@orbitel.bg on Wed, Apr 18, 2001 at 09:06:22PM +0300 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, Apr 18, 2001 at 09:06:22PM +0300, Peter Pentchev wrote: > OK, so this might be really really really stupid, but.. > [snip] > > I somewhat fail to see why a 'bg' of a child process should kill the parent > shell.. I can reproduce this with various combinations of csh, tcsh and bash > as either the login or the child shells. csh/tcsh is the one from today's > -stable, bash is 2.05 from ports. Alright, I think I got it.. I'm not quite sure that tcsh is DTRT, though.. After sprinkling printf()'s all over kill() and killpg1() in kern_sig.c, I got the following: FreeBSD 4.3-RC (RINGWORLD) #56: Thu Apr 19 00:56:15 EEST 2001 This is a MOTD. Live with it. [roam@ringworld:v0 ~]$ tcsh > kill -STOP $$ RDBG kill: psignal 17 to [1139] tcsh [1]+ Stopped tcsh [roam@ringworld:v0 ~]$ bg [1]+ tcsh & RDBG kill: broadcast 19 from [1127 bash] to [-1139] RDBG killpg1_2: psignal 19 to [1139] tcsh [roam@ringworld:v0 ~]$ > RDBG kill: broadcast 1 from [1139 tcsh] to [-1127] RDBG killpg1_2: psignal 1 to [1127] bash RDBG kill: broadcast 1 from [1127 bash] to [-1139] RDBG killpg1_2: psignal 1 to [1139] tcsh RDBG kill: psignal 1 to [1127] bash FreeBSD/i386 (ringworld.oblivion.bg) (ttyv0) login: Then, a ktrace revealed that tcsh, after receiving a SIGCONT and outputting the '>' prompt (just after psignal 19 to [1139]), gets a EIO on read() (quite normal, it's been backgrounded, it has no stdin), and then it happily proceeds to hup its parent process :) Sweet.. but why? :) G'luck, Peter -- If I had finished this sentence, To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message