From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted Date: Tue, 08 Sep 2015 18:49:36 +0300 Message-ID: <83oahc7vxr.fsf@gnu.org> References: <87k2s15sfd.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1441727441 13288 80.91.229.3 (8 Sep 2015 15:50:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Sep 2015 15:50:41 +0000 (UTC) Cc: 21432@debbugs.gnu.org To: Tassilo Horn Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 08 17:50:27 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1ZZLA1-0002eA-AB for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Sep 2015 17:50:17 +0200 Original-Received: from localhost ([::1]:35327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZLA0-0005Oc-TW for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Sep 2015 11:50:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZL9r-0005Jy-Lp for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 11:50:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZL9n-00017q-PN for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 11:50:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZL9n-00017h-Mt for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 11:50:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZZL9n-0002oG-DG for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 11:50:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Sep 2015 15:50:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21432 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21432-submit@debbugs.gnu.org id=B21432.144172736710755 (code B ref 21432); Tue, 08 Sep 2015 15:50:03 +0000 Original-Received: (at 21432) by debbugs.gnu.org; 8 Sep 2015 15:49:27 +0000 Original-Received: from localhost ([127.0.0.1]:52815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZZL9D-0002nO-7j for submit@debbugs.gnu.org; Tue, 08 Sep 2015 11:49:27 -0400 Original-Received: from mtaout25.012.net.il ([80.179.55.181]:44425) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZZL9A-0002nF-Mr for 21432@debbugs.gnu.org; Tue, 08 Sep 2015 11:49:26 -0400 Original-Received: from conversion-daemon.mtaout25.012.net.il by mtaout25.012.net.il (HyperSendmail v2007.08) id <0NUD00H007Q47D00@mtaout25.012.net.il> for 21432@debbugs.gnu.org; Tue, 08 Sep 2015 18:46:07 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by mtaout25.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NUD007Q67SVA8A0@mtaout25.012.net.il>; Tue, 08 Sep 2015 18:46:07 +0300 (IDT) In-reply-to: <87k2s15sfd.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:106247 Archived-At: > From: Tassilo Horn > Date: Tue, 08 Sep 2015 08:36:06 +0200 > > Right now, (at least) the inotify version of `file-notify-rm-watch' > signals an error in case the given descriptor denotes a directory which > has been deleted in the meantime. If it denotes a file which has been > deleted, no error is signaled. > > Here's a receipe: > > (require 'filenotify) > (let* ((flags '(change)) > (handler (lambda () nil)) > (file (make-temp-file "foo")) > (file-watch (file-notify-add-watch file flags handler)) > (dir (make-temp-file "bar" t)) > (dir-watch (file-notify-add-watch dir flags handler))) > (delete-file file) > (delete-directory dir) > (file-notify-rm-watch file-watch) ;; works > (message "Removed file watch") > (file-notify-rm-watch dir-watch) ;; signals an error > (message "Removed directory watch")) > > The documentation does not define any specific behavior for these > situation, so this is currently a gray area which makes it hard for > package developers to develop something which will work right accross > the different notification backends. > > I don't have a strong opinion about what the right behavior would be but > at least it seems inconsistent that you get the error only with deleted > directories. There is no "right" behavior. What you see is what the back-end reports to us. If we want Emacs to be smarter, it's the job of the application, not of filenotify.el.