Mail Archives: cygwin/2001/05/08/11:51:37
Christopher,
Here's yet another patch (hopefully at the location of the
root problem this time).
I'd like to see if you come to the same conclusion as I did.
$ diff -b --unified=3 dtable.cc-orig dtable.cc
--- dtable.cc-orig Sat Apr 28 17:48:27 2001
+++ dtable.cc Tue May 8 06:36:00 2001
@@ -120,7 +120,7 @@
cygheap->fdtab.init_std_file_from_handle (2, err, GENERIC_WRITE,
"{stderr}");
/* Assign the console as the controlling tty for this process if we
actually
have a console and no other controlling tty has been assigned. */
- if (myself->ctty < 0 && GetConsoleCP () > 0)
+ if (ISSTATE(myself,PID_USETTY) && myself->ctty < 0 && GetConsoleCP ()
> 0)
set_console_ctty ();
}
}
Below is the stack trace when stdin is a pipe. Bottom line
(I think) is that we should never get into any of the code
that sets ctty or the tty's pgid for a pipe. I suspect the
missing check above is the reason we got to
fhandler_termios.cc:101 which is where the pgid is
actually getting set.
(gdb) n
101 setpgid (myself->pgid);
(gdb) p myself->procinfo->pgid
$24 = 1116
(gdb) p myself->procinfo->ctty
$25 = 1073741824
(gdb) bt
#0 tty_min::set_ctty (this=0x1c520000, ttynum=1073741824, flags=0)
at /work/build/src/winsup/cygwin/fhandler_termios.cc:101
#1 0x61014b79 in get_tty_stuff (flags=0)
at /work/build/src/winsup/cygwin/fhandler_console.cc:112
#2 0x61014b94 in set_console_ctty ()
at /work/build/src/winsup/cygwin/fhandler_console.cc:119
#3 0x61006f74 in stdio_init () at
/work/build/src/winsup/cygwin/dtable.cc:124
#4 0x6100394f in dll_crt0_1 () at
/work/build/src/winsup/cygwin/dcrt0.cc:815
#5 0x61003d51 in _dll_crt0 () at /work/build/src/winsup/cygwin/dcrt0.cc:928
#6 0x61003d90 in dll_crt0 (uptr=0x0)
at /work/build/src/winsup/cygwin/dcrt0.cc:940
#7 0x469dfb in _size_of_heap_reserve__ ()
#8 0x40103d in _size_of_heap_reserve__ ()
#9 0x77e992a6 in _libkernel32_a_iname ()
-----Original Message-----
From: Christopher Faylor [mailto:cgf AT redhat DOT com]
Sent: Monday, May 07, 2001 11:23 AM
To: 'cygwin AT cygwin DOT com'
Subject: Re: Brainstorming a fix for CTRL-C handling in an emacs shell
buf fer (non-TTY)
On Sun, May 06, 2001 at 10:16:38PM -0600, Troy Noble wrote:
>Christopher,
>
>Looks like t->getpgid() is OK, it's the
>
> t->getpgid () != myself->pid
>
>that's causing the behavior... and I think I understand why
>now. Thanks for leading me in the right direction.
>
>What do you think about the patch below for exceptions.cc
>instead? No extra environment variables required this time ;->
You're still fixing the symptom rather than the problem.
If the program doesn't have a controlling tty then t->getpgid should be
zero. If it isn't zero, then I want to know why it isn't zero.
>to kill other non-cygwin child processes (like java.exe for example)
>when running bash in a shell buffer. They probably had CYGWIN=tty
>set. You probably already knew that,
No, I didn't know that. It's difficult to understand why anyone would
do something that dumb. If they do, they get what they paid for.
Or, rather, I guess I'll get what they paid for because then they'll
send email whining about cygwin instabilities.
cgf
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -