From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.ciao.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: some accept-process-output races fixed; Tramp FIXMEs Date: Mon, 21 Jan 2019 23:09:41 -0800 Organization: UCLA Computer Science Department Message-ID: <650fbe9e-4e42-bc5e-19bd-dea0fbe3356d@cs.ucla.edu> References: <46ce72ef-c4cb-1cd1-566a-c305ca92e68c@cs.ucla.edu> <80d86b5a-efb7-87cc-a3db-0a6ad356274d@cs.ucla.edu> <875zujlkhv.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.org; posting-host="ciao.gmane.org:195.159.176.228"; logging-data="191015"; mail-complaints-to="usenet@ciao.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 Cc: Stefan Monnier , emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 22 08:10:29 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1glqCa-000ncK-Tt for ged-emacs-devel@m.gmane.org; Tue, 22 Jan 2019 08:10:29 +0100 Original-Received: from localhost ([127.0.0.1]:39607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1glqCZ-0004V1-M7 for ged-emacs-devel@m.gmane.org; Tue, 22 Jan 2019 02:10:27 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1glqBt-0004Uj-GC for emacs-devel@gnu.org; Tue, 22 Jan 2019 02:09:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1glqBs-0007JA-RA for emacs-devel@gnu.org; Tue, 22 Jan 2019 02:09:45 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:51004) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1glqBs-0007IH-KP for emacs-devel@gnu.org; Tue, 22 Jan 2019 02:09:44 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 713A0161092; Mon, 21 Jan 2019 23:09:42 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id l6k62o5ovYvI; Mon, 21 Jan 2019 23:09:41 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id AA2A2161106; Mon, 21 Jan 2019 23:09:41 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id UShq8DrXKS-8; Mon, 21 Jan 2019 23:09:41 -0800 (PST) Original-Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 82603161095; Mon, 21 Jan 2019 23:09:41 -0800 (PST) In-Reply-To: <875zujlkhv.fsf@gmx.de> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:232600 Archived-At: Michael Albinus wrote: >> =C2=A0 (while (or (accept-process-output p 0.1) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (process-live-p p))) >> >> that suffer from race conditions. Consider the following sequence of e= vents: >> >> * accept-process-output times out after 0.1 seconds, and returns nil. >> * P generates some data and then exits. >> * process-live-p returns nil. >> >> In this case the loop will exit and lose data. This bug is caused by >> the " 0.1" in that loop. I don=E2=80=99t know why the " 0.1" is there,= but if >> the " 0.1" has to be there then I suppose one way to fix the bug would >> be to enhance accept-process-output so that its caller can distinguish >> a timeout from a connection-closed. > IIRC, the timeout is used because accept-process-output could be blocke= d > otherwise. Tramp has often the need to check whether there is still > output from the process, and the timeout is the only way I know that > accept-process-output returns in finite time. Why does it matter how long accept-process-output takes, when the call is= in=20 that loop? Even if accept-process-output returns in 0.1 seconds, the loop= will=20 just call it again if the process is live. And if the process is dead,=20 accept-process-output cannot block.