From nobody@FreeBSD.org  Tue Dec  2 23:31:40 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CF8BC1065673
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  2 Dec 2008 23:31:40 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id AACB78FC22
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  2 Dec 2008 23:31:40 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id mB2NVeSQ058046
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 2 Dec 2008 23:31:40 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id mB2NVevN058045;
	Tue, 2 Dec 2008 23:31:40 GMT
	(envelope-from nobody)
Message-Id: <200812022331.mB2NVevN058045@www.freebsd.org>
Date: Tue, 2 Dec 2008 23:31:40 GMT
From: Steve Watt <steve@watt.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [t]csh loses foreground process group
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         129378
>Category:       bin
>Synopsis:       csh(1) / tcsh(1) loses foreground process group [regression]
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 02 23:40:01 UTC 2008
>Closed-Date:    
>Last-Modified:  Mon Dec 08 06:16:51 UTC 2008
>Originator:     Steve Watt
>Release:        6.4-PRE as of 16 Sept 08 23:30Z
>Organization:
Watt Consultants
>Environment:
FreeBSD wattres.Watt.COM 6.4-PRERELEASE FreeBSD 6.4-PRERELEASE #11: Mon Nov 24 12:04:45 PST 2008     root@wattres.Watt.COM:/usr/obj/usr/src/sys/WATTRES  i386

>Description:
tcsh 6.15.00 appears to lose track of the foreground process group when SIGINT comes in during backquote expansion.  This problem does not show up with tcsh 6.14.00.

The symptom is that when I do a long-ish running task inside a `` expansion
that I then ^C, nobody gets the foreground process group...  I never get
a prompt back after the ^C, and ^T gets me

  load: 0.27 no foreground process group

Sending SIGCHLD and/or SIGCONT to the tcsh doesn't seem to make any
difference at all.

The tcsh is sitting in "pause" WCHAN, which seems sensible.  A truss
on tcsh reveals (oddly enough) that it's sitting in sigsuspend().
Sending it signals makes it loop through a wait4() call and go back into
sigsuspend().

It happens running either as root (from sudo) or as a regular user.  It
happens under xterm, under ssh sessions, and on a direct console login.

One portable reproduction:
# cd /usr/src
# less `egrep -lir '^Foo.*baz' *`
^Cload: 0.02 no foreground process group

(I typed ^C ^T)

SIGKILL to the shell seems to be the only way to get things back, and it does in your shell.

I also got a "me too" from my posting on -hackers about this which stated that a SIGHUP would also make the shell go away.

>How-To-Repeat:
% cd /usr/src
% less `egrep -lir '^Foo.*baz' *`
^C^T
>Fix:
Use tcsh 6.14.00 (probably not a desirable workaround).

>Release-Note:
>Audit-Trail:

From: Nate Eldredge <neldredge@math.ucsd.edu>
To: bug-followup@FreeBSD.org, steve@watt.com
Cc:  
Subject: Re: bin/129378: [t]csh loses foreground process group
Date: Wed, 3 Dec 2008 16:01:14 -0800 (PST)

 The problem goes away when tcsh is run with -F, and thus this bug is 
 probably related to bin/125185 et al.  tcsh under some conditions will 
 modify global state after vfork(), breaking things when the parent runs 
 again.  -F causes it to use fork() instead of vfork() and then all is 
 well.  IMHO -F should be made the default.
 
 -- 
 
 Nate Eldredge
 neldredge@math.ucsd.edu

From: Nate Eldredge <neldredge@math.ucsd.edu>
To: bug-followup@FreeBSD.org, steve@watt.com
Cc:  
Subject: Re: bin/129378: [t]csh loses foreground process group
Date: Wed, 3 Dec 2008 16:43:08 -0800 (PST)

 This is incorporated into bin/129405.
 
 -- 
 
 Nate Eldredge
 neldredge@math.ucsd.edu
>Unformatted:
