From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5308 invoked by alias); 30 Jun 2011 14:38:50 -0000 Received: (qmail 5287 invoked by uid 22791); 30 Jun 2011 14:38:49 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mpv1.tis.CWRU.Edu (HELO mpv1.tis.cwru.edu) (129.22.105.36) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Jun 2011 14:38:25 +0000 Received: from mpv6.cwru.edu (mpv6.tis.CWRU.Edu [129.22.104.221]) by mpv1.tis.cwru.edu (MOS 4.2.3-GA) with ESMTP id BNB15635; Thu, 30 Jun 2011 10:38:22 -0400 Received: from caleb.INS.CWRU.Edu (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv6.cwru.edu (MOS 4.2.3-GA) with ESMTP id AFM17889 (AUTH cpr); Thu, 30 Jun 2011 10:38:21 -0400 Message-ID: <4E0C8A5D.7000807@case.edu> Date: Thu, 30 Jun 2011 14:38:00 -0000 From: Chet Ramey Reply-To: chet.ramey@case.edu User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 MIME-Version: 1.0 To: Jan Kratochvil CC: bug-readline@gnu.org, gdb-patches@sourceware.org, Sterling Augustine , chet.ramey@case.edu Subject: Re: [Bug-readline] [readline patch, gdb-7.3?] Avoid free from a signal handler [Re: [PATCH] Make interrupting tab-completion safe.] References: <20110612121158.GA10611@host1.jankratochvil.net> <20110626222146.GA4410@host1.jankratochvil.net> <4E0B2E83.9030202@case.edu> <20110629203457.GA28353@host1.jankratochvil.net> In-Reply-To: <20110629203457.GA28353@host1.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A020208.4E0C8A5F.01F1,ss=1,fgs=0, ip=0.0.0.0, so=2010-12-23 16:51:53, dmn=2009-09-10 00:05:08, mode=single engine Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-06/txt/msg00493.txt.bz2 On 6/29/11 4:34 PM, Jan Kratochvil wrote: > On Wed, 29 Jun 2011 15:54:11 +0200, Chet Ramey wrote: >> If you feel that you need to make this change for the current version of >> gdb, go ahead. > > OK. It is not a complete fix but hopefully the one people hit the most. > I have also seen unreproducible crash(es) on a completion CTRL-C myself. > > >> The big problem is to allow operations that read through the file system >> (like completion) to be interrupted without running unsafe functions from >> a signal handler. > > I do not see the problem, readline already does not use SA_RESTART and the > application also gets SIGINT passed by _rl_handle_signal so it aborts the > completion reading on its own, as GDB does by the QUIT macro. > > >> It does the user no good to keep setting the "I got SIGINT" flag if he's >> trying to complete files on a dead or otherwise unreachable file server. > > The syscall should get EINTR without SA_RESTART. But I admit I may not see > the problem now. I have seen cases where the user hits ^C while readline or a filename completion function is attempting to traverse a file system on a dead NFS server, the signal handler gets hit, but the system call doesn't get interrupted. I haven't seen those cases in a while, though. Let's try this. Instead of introducing a leak in free(), remove the references to _rl_interrupt_immediately in complete.c. Those are the only two places where the interrupt handler is called synchronously. I have a couple more changes to make if that doesn't provide the necessary responsiveness. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/