TCL exec kills its owning tty (was: Unable to initialize fd 0 for /dev/tty1)

2010-09-07 Thread Ryan Johnson

 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



Re: TCL exec kills its owning tty (was: Unable to initialize fd 0 for /dev/tty1)

2010-09-07 Thread Corinna Vinschen
On Sep  7 11:22, Ryan Johnson wrote:
  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).

Actually, this is a Cygwin bug.  I can reproduce it and I can
only reproduce it starting with Cygwin 1.7.6, which introduced a
change in the way ttys are handled under the hood.  Apparently  I
managed to break something along the line.

 $ 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.

Unfortunately it also doesn't happen under strace.  So, still digging
for the culprit.  Stay tuned...


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat

--
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