From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#26126: 26.0.50; file-notify-rm-watch removes arbitrary watches Date: Fri, 17 Mar 2017 15:41:19 +0100 Message-ID: <87shmcney8.fsf@detlef> References: <87r31x9ulw.fsf@luca> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1489761736 16461 195.159.176.226 (17 Mar 2017 14:42:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 17 Mar 2017 14:42:16 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 26126@debbugs.gnu.org To: Andreas Politz Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 17 15:42:10 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cot4y-0003LX-Ui for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Mar 2017 15:42:09 +0100 Original-Received: from localhost ([::1]:49312 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cot53-0002a8-59 for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Mar 2017 10:42:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cot4x-0002a1-6I for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2017 10:42:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cot4t-0007Ck-9j for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2017 10:42:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34537) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cot4t-0007CO-5q for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2017 10:42:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cot4s-0000KS-H7 for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2017 10:42:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Mar 2017 14:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26126 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 26126-submit@debbugs.gnu.org id=B26126.14897616931223 (code B ref 26126); Fri, 17 Mar 2017 14:42:02 +0000 Original-Received: (at 26126) by debbugs.gnu.org; 17 Mar 2017 14:41:33 +0000 Original-Received: from localhost ([127.0.0.1]:60969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cot4P-0000Jf-9R for submit@debbugs.gnu.org; Fri, 17 Mar 2017 10:41:33 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:50676) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cot4N-0000JQ-AO for 26126@debbugs.gnu.org; Fri, 17 Mar 2017 10:41:32 -0400 Original-Received: from detlef.gmx.de ([93.209.75.8]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MPUFR-1cszfF3OeP-004gve; Fri, 17 Mar 2017 15:41:20 +0100 In-Reply-To: <87r31x9ulw.fsf@luca> (Andreas Politz's message of "Thu, 16 Mar 2017 15:14:35 +0100") X-Provags-ID: V03:K0:vvjifoQbGOc6qf4SqKUfy/dxbi6vqyB6eFMomUL9PNzVHmeXb9f 6Zw5kikH8kwrBBfZNOxp+UtRPnOH81EsKIFlwsQPy+i74w4I80ZHMOubweIqjYaRyCng9kT XLVxhjtbFyQ6Fob+GkZoM7czYbZmAsLIfE4OmNywQ01qSnGcSRiayM0ink+jDiWBYkCQYTy Iqvv7yUfSpZkvsIMyBb2Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:13xjj3ungbM=:Gfxs9QFfnZhJNhsT9a/CFm EyRCB+qfJ+FaJvnJEfEjB+QGM6fMwXWf/HI9fWMT6MTT1maqHWkAdgYBJQpde/+XdZaObjVr3 BjgwjaTOboR2sIlwL5fvqweXFoY5xnw3dIy9H1hYJGiq82Nejy/4Rml0+IjynQiIAHQsjqErx IoX8mCsXvPn6WnPchBUUYsH3Yej9vpLhrOx1lqXTW82q/2/r6dcDEr1LNrKiNHQncQ9WzOGGF qYkLqq/dJQc8nAW+PIfG8uTjUwDuQb/iKv9dfZDeeba9MDMIT05Og4ZkU4Niza+ercqbTwm2n iq9E+Zg7foskPWI9NiZXP9p9VImhgI5CJ4mSfOY0ylkTxGC5bTk2X9V0XfPqE6+mFIZWsS/oR 574asvtYTWMvVk8n1uj0MUdya+z9jsOgXRk1LkZVyAqCiBF6zq8+XcYskHrqHeWBZ4DtPG4ML TnDvaTNSKZ8r98HiS9IldaGC4M7RadVAqORGLWSy3l+4uB69GQgFoZ1SW+1757ILcZGsO1qoJ 9SnsLz06BA/5YeW1M1o23DShKHQNKTveGoxbf1KurrbZnTKNzV8rZrGL9uRjNFCwaK5zaloXg S1XxFPqrJijhWWddl1opCDhxoG2kP5Y3+pZ5lfsKbw1w90HFZRLayksgT5BvMxTleXBk1Nr+r vYWsC2MlMi4BgKD5F2I8eRXZ1LcwDLyBDA0qCRGJLNZTBIllM4V/JEnyMn2Exs8/9kDApmT9R G+WNtu/Re9rCTpa1wfD0lOl3VBwy4sCpmablxbF+YGNc/w6wec/CSqiOOzdw2Dfm6G+CvfU5 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:130675 Archived-At: Andreas Politz writes: Hi Andreas, Thanks for the bug report. > The descriptor returned by file-notify-add-watch is of the form (ID . DIR) > (at least when using inotify) and these descriptors are stored in a > hash-table using equal as comparator. Yes. > If multiple clients watch the same file and one of them removes its watch > via file-notify-rm-watch, the result is unpredictable. I.e. the function > removes some watch (I believe it is the last one added), but not necessarily > the one associated with the client calling file-notify-rm-watch on the > descriptor it got from calling file-notify-add-watch. With the returned descriptors, it cannot be decided which watch has to be removed, because both descriptors are equal. So we could decide either to remove all watches for a given file if such a descriptor is passed to `file-notify-rm-watch', or we must adapt `file-notify-add-watch' to return different descriptors. I'm undecided yet. Note, that this problem seems to be specific to inotify. Other libraries do not suffer from this problem, I believe. > I've attached a test case for this. Thanks. I've added this, modified, to `file-notify-test02-rm-watch' for my internal tests. Will be pushed to master once I have a solution for the problem. > -ap Best regards, Michael.