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: Sun, 19 Mar 2017 10:39:11 +0100 Message-ID: <87wpbl1u80.fsf@detlef> References: <87r31x9ulw.fsf@luca> <87shmcney8.fsf@detlef> <87efxw7xvc.fsf@luca> <87mvcjophx.fsf@detlef> <87tw6rssoi.fsf@luca> <87pohfkmvh.fsf@detlef> <87lgs2sobr.fsf@luca> <87y3w2gywc.fsf@detlef> <878to21fty.fsf@luca> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1489916417 28192 195.159.176.226 (19 Mar 2017 09:40:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 19 Mar 2017 09:40:17 +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 Sun Mar 19 10:40:12 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 1cpXJp-0005uQ-V9 for geb-bug-gnu-emacs@m.gmane.org; Sun, 19 Mar 2017 10:40:10 +0100 Original-Received: from localhost ([::1]:56100 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpXJq-00016z-VH for geb-bug-gnu-emacs@m.gmane.org; Sun, 19 Mar 2017 05:40:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpXJl-00016o-KT for bug-gnu-emacs@gnu.org; Sun, 19 Mar 2017 05:40:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpXJi-00042Y-Uj for bug-gnu-emacs@gnu.org; Sun, 19 Mar 2017 05:40:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36350) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cpXJi-00042U-RP for bug-gnu-emacs@gnu.org; Sun, 19 Mar 2017 05:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cpXJi-0003RV-Kb for bug-gnu-emacs@gnu.org; Sun, 19 Mar 2017 05:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Mar 2017 09:40: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.148991636213176 (code B ref 26126); Sun, 19 Mar 2017 09:40:02 +0000 Original-Received: (at 26126) by debbugs.gnu.org; 19 Mar 2017 09:39:22 +0000 Original-Received: from localhost ([127.0.0.1]:34549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cpXJ4-0003QS-5S for submit@debbugs.gnu.org; Sun, 19 Mar 2017 05:39:22 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:57808) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cpXJ2-0003QC-4w for 26126@debbugs.gnu.org; Sun, 19 Mar 2017 05:39:20 -0400 Original-Received: from detlef.gmx.de ([93.209.91.26]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0Ldcv0-1cOlH82qSQ-00ij6N; Sun, 19 Mar 2017 10:39:12 +0100 In-Reply-To: <878to21fty.fsf@luca> (Andreas Politz's message of "Sat, 18 Mar 2017 21:37:45 +0100") X-Provags-ID: V03:K0:Bfr2ygRbtUVaIOpljYwf4vk/4tQO4A1/FV9OQl4ugDZsyVlHtkx K9LlbK9tUIhAKVYkKxIo9WGE1Y5y8llyqTaNCiufvK91ymfPUbpnNfpc82sMkuLdn++o9JP kWlVfE2/VYGBjAScPdEcbF+Fo0UEISEiHoJ5OndPReKYAc3SomHsCLkmCyec77pYYP6FlKq aitGnwotv0WalA9XRN4NA== X-UI-Out-Filterresults: notjunk:1;V01:K0:trsVtwx8AOk=:5fi9v0pZMe3kapR9m/qYqC LVa+ZBs9FjdYaM1wexl7xYKy2GjafDWaQRqYYgDbli4u9F8PnaVdBG+Cm12HACz1q6eICRXLr hzlkqsAfImydtc3lMl4a0FKPlmcnCrxRh+57P/DXcHHMqDigTL6C6Dy5PFcQ307SZvvhbCNO9 ZO5K9+n8NA0MJbAm3gvknDCtypOk3gQNpfoECS4BPv8VUnbJmRXdvP2qRX8+iWH1SbJRr1AJL vD9kjqgEEXaWxLohrV1ErLI8D3hAGQ6vAx3igOw8r70dWrIj3gDqcCSPDn84UAUYpCUiQ1I4S urHn8pocARQRh+VTSN/TK9ETqvnze09FbNK8OleJoWz10a9aD4dzbKK1Vy6XDuqBpEu0i3RAi B9BTQLuqONYZJzaiTvBm7o7wtpQrsRp1m/mavESYjKau5lnadCAztx3q4B7LhePdLHL4z0Reu 8UQPNN+5cQQKBxsidzZU+V5ZGbkaUGxf93pWV0MQpkdrx1fPXfuWIhJAJPsk4e/NceWxh2eUh wu0ylwEBZCmIIz0yRRmJdCDgJSMkuXUEpcr4GvHa9ieA59MgxTf+MSzw3itHlrplxvWizUWk8 BQqlLpbMSnxWoRp1RGh56dJJyVU8BgU1UOb3pye1q7NfFoylBTvBsrheDEKWXJ9vix/+sht3Y 0xE8B3EYGoRCfBdcJD0krBDzDQzf1szhwhmNj7SqP+3yi9R+4Cfa7piillHjyky1faFL1qTcC RyKnO4tO40L1789Kdwi0GlaZVDzWHxTmL+ufPqKpuaK3+g8YraDl1tINGcHDrcp7E8zHMRKi 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:130724 Archived-At: Andreas Politz writes: Hi Andreas, > inotify seems to be inode-based, so it emits notifications independent > of the filename used. I think that hard-links are not commonly used > under win32, but I don't know. Yes, inotify watches inodes. > I we stay with string-equal, we are watching filenames, not files. > Which is probably sufficient/OK. Maybe this should be mentioned in the > manual, I made a note of it. The docstring speaks about filesystems. This is a hint, that the behaviour of the libraries might differ. >>> + Watching a /dir/file may receive events (e.g. touch /dir) for dir. >> >> Could you pls give an example? > > With inotify: > > (let ((desc (file-notify-add-watch > "/tmp/file" '(attribute-change) > (lambda (_) (cl-assert nil))))) > (unwind-protect > (progn > (shell-command "touch /tmp") > (sit-for 3)) > (file-notify-rm-watch desc))) Yes, I remember. For all backends except kqueue, we watch the directory. This is intended. >>> + Why is the existence of kqueue checked for the handler in >>> file-notify-add-watch ? After all we don't know how this handler will >>> operate. >> >> Why don't we know what kqueue does? > > This: > > (if handler > ;; A file name handler could exist even if there is no local > ;; file notification support. > (setq desc (funcall > handler 'file-notify-add-watch > ;; kqueue does not report file changes in > ;; directory monitor. So we must watch the file > ;; itself. > (if (eq file-notify--library 'kqueue) file dir) > flags callback)) > > Why should we assume that handler is somehow related to kqueue ? I think > its just a copy and paste error. The comment should be moved to the > actual library call below this. This looks like an error, indeed. I will check. > I also wonder, if the passed argument should not always be the filename > for which the watch was requested, as opposed to its directory. After > all we should not make assumptions about the abilities of the underlying > mechanism. For example it could work similar to kqueue, i.e. with an > inability to watch directories. We've discussed this years ago, maybe you find it in the archives. There are problems when you watch only the file. This doesn't work for example when you want to watch a file which does not exist yet. Or which disappears, and reappears. The agreement was to watch the upper directory. This works for all backends except kqueue. > Thanks for you response, > -ap Best regards, Michael.