X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.6 required=5.0	tests=AWL,BAYES_00,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4C86046F.2070402@ece.cmu.edu>
Date: Tue, 07 Sep 2010 11:22:55 +0200
From: Ryan Johnson <ryanjohn@ece.cmu.edu>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: TCL exec kills its owning tty (was: Unable to initialize fd 0 for /dev/tty1)
References: <4C855E65.1060907@ece.cmu.edu>
In-Reply-To: <4C855E65.1060907@ece.cmu.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

  On 9/6/2010 11:34 PM, Ryan Johnson wrote:
> The last couple days I've gotten some really strange errors. Sometimes 
> I'll alt-tab to an xterm window and start typing, only to have it 
> disappear at the first keystroke. Sometimes `emacs -nw' will get hit 
> instead, leaving both emacs and the xterm pretty much unusable. I 
> haven't been able to get a stack trace
I can reproduce this bug reliably with both 1.7.7 and 1.7.6 versions of 
cygwin1.dll (which makes me suspect the problem is not there).

The reason I couldn't get a stack trace is because the xterm doesn't 
receive an error... it just gets an EOF and dutifully exits. Sometimes 
you can see 'exit' appear just before the window closes.

After some digging, it looks like TCL is the culprit (recall I was 
running tkdiff). Here's a minimal test case, which will close its 
controlling tty when it exits:

$ echo 'exec ls' > tty-killer; tclsh tty-killer &

Running the script in the foreground, passing it as a -c argument to 
bash, or piping it into tclsh, does *not* expose the bug.

Ideas?
Ryan



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

