Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <8F23E55D511AD5119A6800D0B76FDDE11E102E@cpex3.channelpoint.com> From: Troy Noble To: "'cygwin AT cygwin DOT com'" Subject: RE: Brainstorming a fix for CTRL-C handling in an emacs shell buf fer (non-TTY) Date: Wed, 9 May 2001 09:03:20 -0600 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Scanned-By: MIMEDefang 1.0 (http://www.roaringpenguin.com/mimedefang/) I am using unmodified bash-2.05.0-5 from the cygnus-latest, and a cygwin1.dll that I built from the CVS sources that I checked out fresh ("cvs co" as opposed to "cvs update") right after your last patch to exceptions.cc. The only winsup/cygwin modification I had in place at the time was the printf in the ctrl_c_handler so I could see what was going on there. I looked at the bash sources some last night, and it seems to me that since bash thinks it is running in a pipe (stdin is a pipe after all), I think it's never passing control of the tty on to the child. There are some comments in jobs.c:make_child to that effect. That would explain why t->getpgid() != myself->pid. Does not explain why bash isn't SIGTERM-ing its children as you suspect might be happening. Here's the minimal test case I have come up with that you can try there without installing emacs. You'll need to add the printf to ctrl_c_handler to get the same type of output. Then start a cmd.exe window and do the following: C:\work\build\src\winsup\cygwin>cat /tmp/tmp.sh sleep 10 C:\work\build\src\winsup\cygwin>bash getsid()=680 t->getpgid()=680 myself->pid=1388 pgid=680 ppid=680 sid=680 progname=c:\cygwin\bin\sleep.exe GetConsoleCP=437 isatty=0 pid_exists=1 t->getsid()=680 t->getpgid()=680 myself->pid=680 pgid=680 ppid=1 sid=680 progname=c:\cygwin\bin\bash.exe C:\work\build\src\winsup\cygwin>bash % sleep 10 GetConsoleCP=437 isatty=1 pid_exists=1 t->getsid()=1400 t->getpgid()=288 myself->pid=288 pgid=288 ppid=1400 sid=1400 progname=c:\cygwin\bin\sleep.exe GetConsoleCP=437 isatty=1 pid_exists=1 t->getsid()=1400 t->getpgid()=288 myself->pid=1400 pgid=1400 ppid=1 sid=1400 progname=c:\cygwin\bin\bash.exe Troy -----Original Message----- From: Christopher Faylor [mailto:cgf AT redhat DOT com] Sent: Tuesday, May 08, 2001 5:59 PM To: 'cygwin AT cygwin DOT com' Subject: Re: Brainstorming a fix for CTRL-C handling in an emacs shell buf fer (non-TTY) On Tue, May 08, 2001 at 05:46:05PM -0600, Troy Noble wrote: >Looks like a I caught a break this time. > >I can't tell if we're converging on a solution at this point or >diverging. However, I did want to get you some usable strace >output if possible. This is a symptom of things working, though. I'm trying to get an strace of a failing situation. >Let me know if I've worn out my welcome or if you want me to >move to the developer list to cut down the traffic on this list. > >I started bash in an emacs buffer, then ran "strace bash", >then ran my "ls -lR". Then pressed CTRL-C. > >If I read the strace output correctly, >it looks like bash figures out that it has a child process, >and I can see the child process responding to the SIGINT signal. I don't see bash sending a SIGINT. >The "ls" process ctrl_c_handler never gets invoked, which is >good. So I'm 99% sure that ls shut down in response to bash's >signal. Bash then detects that the child exited and removes >it from its table of child processes. It does receive a SIGINT and die but I don't know why. Are you working with a pure Cygwin from CVS? cgf -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple