X-Spam-Check-By: sourceware.org Date: Wed, 6 Dec 2006 12:59:47 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Bash process remains after I close rxvt in certain ways Message-ID: <20061206115947.GN9829@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <45586C29 DOT 4050805 AT byu DOT net> <45588A58 DOT 3080704 AT cwilson DOT fastmail DOT fm> <20061113161012 DOT GA6263 AT trixie DOT casa DOT cgf DOT cx> <457685E6 DOT 1050202 AT cwilson DOT fastmail DOT fm> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <457685E6.1050202@cwilson.fastmail.fm> User-Agent: Mutt/1.4.2.2i Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Dec 6 03:57, Charles Wilson wrote: > [nothin' like resurrecting a month-old thread...] > > Christopher Faylor wrote: > > >This is handled in dcrt0.cc:do_exit(). I'm wondering if rxvt is not > >dealing with the SIGHUP that cygwin should be sending to it on > >CTRL_CLOSE, though. > > Well, rxvt *does* respond to SIGHUP: > > $ ps -eaf # output snipped > cwilson 3796 1 con 01:22:47 /usr/bin/rxvt > cwilson 392 3796 3 01:22:47 /usr/bin/bash > > $ kill -HUP 3796 > > $ ps -eaf # output snipped > cwilson 392 1 3 01:22:47 /usr/bin/bash > > but leaves behind a zombified bash. Further, because rxvt is compiled > as a console app, Windows does not send a WM_CLOSE message when you > press Alt-F4 or click the 'x' button: for console apps it sends a > CTRL_CLOSE_EVENT, which is intercepted by cygwin and translated into > SIGHUP -- so my discussion here: > http://cygwin.com/ml/cygwin/2006-11/msg00312.html I just debugged this a little bit purely from the Cygwin perspective and I found that Cygwin does not get a CTRL_CLOSE_EVENT when you press the X button of the rxvt window or press Alt-F4. The explanation for the orphaned shell must be a bit more tricky. When running strace, I'm wondering about the below when, for instance, Alt-F4 is pressed: 24 1990559 [main] rxvt 3748 kill_pgrp: pid 3748, signal -1 [...] 31 1991910 [main] rxvt 3748 __set_errno: int kill_pgrp(pid_t, siginfo_t&):314 val 3 23 1991933 [main] rxvt 3748 kill_pgrp: -1 = kill (3748, -1) So, what happens is that rxvt only tries to kill its own process group. This won't kill the shell which is the process group leader of its own process group. So there's something missing in the picture here... What does happen in rxvt when Alt-F4 is pressed. Nothing? Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/