From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.devel Subject: Re: fix latent bug in process.c Date: Tue, 14 Aug 2012 08:45:25 -0600 Message-ID: <87393p4jne.fsf@fleche.redhat.com> References: <87txw661c8.fsf@fleche.redhat.com> <87ipcm4i79.fsf@fleche.redhat.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1344955541 23525 80.91.229.3 (14 Aug 2012 14:45:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 14 Aug 2012 14:45:41 +0000 (UTC) Cc: Emacs discussions To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 14 16:45:41 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T1INI-0005LE-JS for ged-emacs-devel@m.gmane.org; Tue, 14 Aug 2012 16:45:40 +0200 Original-Received: from localhost ([::1]:47020 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1INH-0003am-Kn for ged-emacs-devel@m.gmane.org; Tue, 14 Aug 2012 10:45:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1IN9-0003HZ-3G for emacs-devel@gnu.org; Tue, 14 Aug 2012 10:45:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1IN6-0007zb-Oo for emacs-devel@gnu.org; Tue, 14 Aug 2012 10:45:31 -0400 Original-Received: from mx1.redhat.com ([209.132.183.28]:47267) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1IN6-0007zL-Gd for emacs-devel@gnu.org; Tue, 14 Aug 2012 10:45:28 -0400 Original-Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7EEjRq5018015 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 14 Aug 2012 10:45:27 -0400 Original-Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q7EEjPHu014471 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 14 Aug 2012 10:45:26 -0400 X-Attribution: Tom In-Reply-To: (Andreas Schwab's message of "Mon, 13 Aug 2012 23:19:42 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:152513 Archived-At: >>>>> "Andreas" == Andreas Schwab writes: Andreas> Tom Tromey writes: >> The second part is really the interesting one though. Andreas> If select can't figure out whether an fd is writable, it must Andreas> be assumed to be always writable, otherwise it will never be Andreas> written to. Ok, thanks. That makes the first bit make sense. However, I still don't understand why we'd bother selecting for write and then ignore the results. If we're going to do this it seems like we might as well not pass these bits to select at all. What do you think of the appended instead? This should preserve the current behavior if SELECT_CANT_DO_WRITE_MASK; but properly check the results from select elsewhere. Tom * process.c (wait_reading_process_output): Check Writeok bits, not write_mask. diff --git a/src/process.c b/src/process.c index 0be624a..18775c5 100644 --- a/src/process.c +++ b/src/process.c @@ -4792,7 +4792,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, && d->func != 0 && (d->condition & FOR_READ) != 0) d->func (channel, d->data, 1); - if (FD_ISSET (channel, &write_mask) + if (FD_ISSET (channel, &Writeok) && d->func != 0 && (d->condition & FOR_WRITE) != 0) d->func (channel, d->data, 0);