From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: master e9e807e: Don't remove notify descriptor that is already gone Date: Fri, 19 Apr 2019 16:56:55 +0200 Message-ID: <87wojqhwlk.fsf@gmx.de> References: <20190415083338.9906.18508@vcs0.savannah.gnu.org> <20190415083339.64FE620536@vcs0.savannah.gnu.org> <871s2277mv.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="243996"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 19 16:57:50 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hHUxZ-0011Kc-Ex for ged-emacs-devel@m.gmane.org; Fri, 19 Apr 2019 16:57:49 +0200 Original-Received: from localhost ([127.0.0.1]:57553 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHUxY-00011z-Fj for ged-emacs-devel@m.gmane.org; Fri, 19 Apr 2019 10:57:48 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHUws-00011m-Vp for emacs-devel@gnu.org; Fri, 19 Apr 2019 10:57:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHUwr-0004WP-P1 for emacs-devel@gnu.org; Fri, 19 Apr 2019 10:57:06 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:43941) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hHUwr-0004Tf-FF for emacs-devel@gnu.org; Fri, 19 Apr 2019 10:57:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1555685818; bh=v1efLWArivKkRG+6/7TnrucPRBoGxDU/8wHfDeHzOLI=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=LdyIbUwQ4PzaJKjA/9dXcyknEeypclMmoXAMsq3qFPpPWnnCLAhVZlfe/zb3N416B kLHr9yGwooqQzAD3ANG5QPuTrjbldybtTgH9r3C6LyoMQASzCqk/PQwQW/35QP2ZZH hebkn41g105cYQ0iJHuqg9Q4pUCDTl/8iszTRfZA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from detlef.gmx.de ([212.86.38.58]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MKLeM-1hJ9dk2INy-001f5u; Fri, 19 Apr 2019 16:56:58 +0200 In-Reply-To: ("Mattias \=\?utf-8\?Q\?Engdeg\=C3\=A5rd\=22's\?\= message of "Tue, 16 Apr 2019 15:31:08 +0200") X-Provags-ID: V03:K1:JMShYqgrB8AMRD0Gqbe7im3y1iy3xNekuDWoEI2cilUIARF7MqD xOyV79s1nROfyGUY13r+7lRcEHqQQeARvWK2xbxPxw+DYxkARKoE1y3kt8GKCCAOnlpurZS zxmp1ehGuuNUo7Jeia7fPjJcGO6vTursbOs5wse8Q4PBVNDX/7JeaI9t76vW003e2bOPymK TtWGYszBA7rQ8cdZC5WHA== X-UI-Out-Filterresults: notjunk:1;V03:K0:SECWGv9Y10I=:WajhXclnQY0ZQ08/LB68xM tsaeifnP8XV0fRd12vRZE/pE5axFTkOKvnHO46CkkQdm8EcdUhToGSjA7gj6kCthwe5ypKMqd gr7yAxlSXnLwID4rWVkrt+OL5kvN1nbzzm8qizfuhjGdw8dwFbNHyTly6lcBNZqW+ztv9B+eH YSfBjAmvKATathoGVQXJkNf3VRRTRj2beJkZH9+enYZndlQu0NP/MW9rng0ly4Odl/OqUM3BH UQWdrydM7BvppJFSU46md9AiPBwtLQDIZKSbRisEx4melW0bawbJlJvaMerJhHl88xVpBeLJg md17KHPWDiutnn1DUaplb2LBYJ2K/5xxpKnfzA884f+sABRu2qyVotf29gFk4PJDzfb12TB3/ amnIKDbA8TU7YTuQBEEcy13BJB0GNJSHbUkV2M/kGMsOXg7DeBAbveSk1K95uKPfPv4iWhYIP BhD5h5BCpgmsyQSlikYd5WNjgO2BnxW6+fgciB9SDQUzeqWnAvy246BBhOLlZwy11cR7LeyS1 /f6dbvwWpG54ZEBoTGri+s+13Zmeqy3NkWNPOcijStZPSOLOzkJGEXMmfLex77RbyOIt8W+a9 F2v+dJoqTCLjSLeKFljJjf227ZmzgeZSO7gM7PZ8bTRNyCp4fd1RgpU0zGWy1ELxDYD3KLYGy C4TGwvqORIdDzxhGwXZQP3MO57HacZqtIypgdY1snvwCaD5CFocDquCBDW8i9riPzF3RLoEcL z39q0jN8nNAiWUdSdlLecN1zDsl5CvJt2Mw8CDygKAhBSeZ9EVL98jd4xuYL2WcPXpiZgCxP X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.22 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:235661 Archived-At: Mattias Engdeg=C3=A5rd writes: Hi Mattias, >> I haven't tested thoroughly yet, but wouldn't it suffice if in >> auto-revert-notify-rm-watch there is just the test >>=20 >> (when (file-notify-valid-p auto-revert-notify-watch-descriptor) >>=20 >> instead of >>=20 >> (when auto-revert-notify-watch-descriptor > > Thanks for reading my change. It is a fair question! > > First of all, the descriptor wouldn't then be removed from > `auto-revert-notify-watch-descriptor-hash-list' since that part is > also guarded by the condition, but that's just a matter of rearranging > code. Yes. > (Not only is `auto-revert-notify-watch-descriptor-hash-list' a > mouthful, it is a bit misleading. It maps descriptors to lists of > buffers. How about `auto-revert--buffers-by-watch-descriptor'?) No objection. > Slightly more robust would be to stop reusing descriptors: either made > mutable, so that they can be invalidated, or made unique by using a > counter. However, the basic design is still somewhat dubious: it tells > us whether the descriptor is valid, but that just raises the question: > why do we even have to ask? Correct code should understand its own > invariants. In theory you are right. But I fear there could be situations where such assumptions do ne keep. A double-check is OK. > Now that you `mentioned auto-revert-notify-rm-watch', does it strike > you as odd the way it does > > (maphash > (lambda (key value) > (when (equal key some-key) > do-something)) > some-hashtable) > > instead of using the hash table directly? Suggested patch to fix this > attached. I'm still not convinced that we need REMOVE-DESCRIPTOR. We shall always remove the descriptor, and assure, that no superfluous events are raised. > By the way, why don't we give each buffer in auto-revert-mode a unique > descriptor, so that the table just maps descriptors to buffers, > instead of to lists of buffers? It would simplify the code in many > places, and it cannot be that common to have multiple buffers for the > same file that it warrants the descriptor-sharing optimisation. Well, the descriptor is the one we get from filenotify. I don't believe we shall do double housekeeping. Sounds to me error-prone. Best regards, Michael.