X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Fri, 6 Jun 2008 13:54:26 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: abort() bug Message-ID: <20080606175426.GA31949@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.16 (2007-06-09) 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 Fri, Jun 06, 2008 at 04:32:27PM +0000, Eric Blake wrote: >Any reason that cygwin abort() closes all stdio streams prior to issuing >SIGABRT? This is a difference from Linux, and makes it difficult to install a >cleanup handler that prints a nicer error message. POSIX states that "The >abnormal termination processing... may include an attempt to effect fclose() on >all open streams", but is also clear that abnormal process is thwarted if "the >signal SIGABRT is being caught and the signal handler does not return". STC: > >[snip] > >This application has requested the Runtime to terminate it in an unusual way. >Please contact the application's support team for more information. >3 > > >Obviously the SIGABRT handler is running whether abort is called directly or >via a failed assertion, based on the change in exit status and lack of core >dump. But it seems a shame that stdio has been lost. On Linux and mingw, this >example correctly prints "goodbye, cruel world" when the handler is invoked >(well, mingw abort() injects extra text regardless of whether there is an abort >handler installed, and the lack of a handler exits with 3 rather than 134). > >In other words, I think that signal.cc needs to rearrange the >_GLOBAL_REENT->__cleanup to occur _after_ _my_tls.call_signal_handler. I think you're right. The call to call_signal_handler was added years after the addition of the cleanup so it would make sense to move the cleanup handling after that. Want to submit a patch? cgf -- 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/