Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Date: Sat, 8 Jan 2005 21:53:37 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: Problem with 20050106 snapshot Message-ID: <20050109025337.GG3713@trixie.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com References: <16864 DOT 26477 DOT 82750 DOT 561543 AT gargle DOT gargle DOT HOWL> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="nFreZHaLTZJo0R7j" Content-Disposition: inline In-Reply-To: <16864.26477.82750.561543@gargle.gargle.HOWL> User-Agent: Mutt/1.4.1i --nFreZHaLTZJo0R7j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Jan 08, 2005 at 03:06:21PM -0800, David Rothenberger wrote: Content-Description: message body text >I'm having a problem with the 20050106 snapshot as well as my own >DLL build from CVS HEAD on 20050107. I've also seen these problems >in snapshots from late last year. I've just now isolated a small >test case. > >The problem is with bash killing native processes. I have a bash >script that starts a native process in the background, installs a >signal handler for SIGINT, grabs the pid from the background >process, and then issues wait. The signal handler tries to kill the >pid that was captured. > >With 1.5.12 and a DLL built from CVS on 11/19/2004, this works just >fine. With the latest snapshot, I often (but not always) get a "Bad >file descriptor" error from kill. > >I've enclosed a C file with the source for a simple program that >sleeps for the time specified on the command-line. I compiled this >as a WIN32 application using > > % gcc -o sleepMingw -mno-cygwin sleepMingw.c > >I've also enclosed the driver script sleepTest.sh. > >Here's the output from one run: > I modified the script as attached and ran it for about ten or fifteen minutes and didn't see this behavior but, unless I'm missing something, I don't see how this would ever work reliably, though, since, if you're hitting CTRL-C in a console window, it will be propagated to all subprocesses. Cygwin processes know how to deal with this but mingw processes don't and will just catch the CTRL-C and do what a windows console process would normally do. In this case what they'd normally do is exit. The "file not found" error code is a little odd in this case, though. I tightened up some of the errno setting and will be checking in some new code to deal with some problems that Pierre found with windows processes, soon. The loop I used was: while ./sleepTest.sh 60; do :; done it never exited. cgf --nFreZHaLTZJo0R7j Content-Type: application/x-sh Content-Disposition: attachment; filename="sleepTest.sh" Content-Transfer-Encoding: quoted-printable #!/bin/bash set -x ./sleepMingw $* & enTrapSIGINT () { echo "killing process $pid"; { kill $pid && exit 0; }; ex= it 1; } pid=3D$! trap enTrapSIGINT 2 x=3D$$; (exec kill -INT $x) || exit 1 wait --nFreZHaLTZJo0R7j Content-Type: text/plain; charset=us-ascii -- 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/ --nFreZHaLTZJo0R7j--