From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#21435: 25.0.50; file-notify has problems after renames Date: Wed, 09 Sep 2015 20:41:55 +0200 Message-ID: <8737ynv3ik.fsf@gmx.de> References: <87y4gh47sr.fsf@gnu.org> <83k2s07vaf.fsf@gnu.org> <87fv2ovlcr.fsf@gmx.de> <83613k7owe.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1441824152 29248 80.91.229.3 (9 Sep 2015 18:42:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Sep 2015 18:42:32 +0000 (UTC) Cc: 21435@debbugs.gnu.org, tsdh@gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 09 20:42:23 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 1ZZkJy-0000Gr-Nr for geb-bug-gnu-emacs@m.gmane.org; Wed, 09 Sep 2015 20:42:14 +0200 Original-Received: from localhost ([::1]:44584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZkJy-0000r5-DV for geb-bug-gnu-emacs@m.gmane.org; Wed, 09 Sep 2015 14:42:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZkJs-0000nM-N0 for bug-gnu-emacs@gnu.org; Wed, 09 Sep 2015 14:42:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZkJm-0003BP-Ns for bug-gnu-emacs@gnu.org; Wed, 09 Sep 2015 14:42:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33690) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZkJm-0003BH-Kr for bug-gnu-emacs@gnu.org; Wed, 09 Sep 2015 14:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZZkJm-0005tX-A4 for bug-gnu-emacs@gnu.org; Wed, 09 Sep 2015 14:42: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: Wed, 09 Sep 2015 18:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21435 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21435-submit@debbugs.gnu.org id=B21435.144182412122653 (code B ref 21435); Wed, 09 Sep 2015 18:42:02 +0000 Original-Received: (at 21435) by debbugs.gnu.org; 9 Sep 2015 18:42:01 +0000 Original-Received: from localhost ([127.0.0.1]:54133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZZkJk-0005tI-Oy for submit@debbugs.gnu.org; Wed, 09 Sep 2015 14:42:01 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:55592) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZZkJi-0005t9-8A for 21435@debbugs.gnu.org; Wed, 09 Sep 2015 14:41:58 -0400 Original-Received: from detlef.gmx.de ([87.146.52.139]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0MOBOi-1ZWQOP0Qya-005X6q; Wed, 09 Sep 2015 20:41:57 +0200 In-Reply-To: <83613k7owe.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 08 Sep 2015 21:21:37 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-Provags-ID: V03:K0:Q4OLP1UhE5QhOBXDZSGrdZKbD/triF5iACfmBeKodWYibzOhjgB McKm/cFeZAK5rIFiO+brQZ6DuUclFjPxUu42fkV7SpLE7BMx4BqXojFSdLAgEu7u3RImBNj WWkxmT0QWVVP51SVvyqLq5KxSeAXEua+u/yDBlTqZQWPlzLE9LkT5yDe45+navSxvz1Fd6y cSdQQRMWuvrzLGB8VpBSw== X-UI-Out-Filterresults: notjunk:1;V01:K0:xMI3hUWz4ho=:FcK/g+6qk9XaweURni0s+r VDsAxId4NOAZdj5ztvw3efRioAjUpB9fvnh7uIKUXALNpeIeeoYQr71OrOp67Xhgd8vrDaP5u AHLuBiUnHXkKIiSGT/k65WRM3JIdPKNlC0uKx44QdjrUAZIgcoip3PyYVzhn3uxR41gw7sfIP GoCUL/0l7jYXox19llEzpK7lniaZ5gcdVtgp5FwDXb5LnZBBXVsYwACcNl2n3WIqwL+NXXXO2 5ZiNKfOXi8jQ3IvzvDGZGdTzJR8C3w8e17ivrIBuL1FrKgZPjXeokdwAuJrrb7vfbZJV5NetU l2lQNbjaGiwLQ+9m8HPz193mlRrSDYHIc53Q0QaHB2Yi8iOqfh1gRMg9wvfnOSN9VH16rCmoi ZlXCRdYblunCrHY8/W23r7k2u14Ok8JovQxtB9iEG4AWUL8eHwXBqdK1x5xLnLnhkU41eak8Q QbzmuI6OpqCXZYbsyCHa1GzjRdP2skh+px5sdOto3q8BTv5uIzRj0vI+GVGfEr0ms8qnvAeQz iAK3Lo3qsQV1fW9P43Vsy32jA9xV/fPdV6pUpoB7+O4KJz+dqu6Dcy74FRlB/bfNbnbSQ+bBX uboYN7K36Haxb/8LeQ+xVeZhgend0EFS0u5jVC7+SgxQOtZhTlc04hfM0gieuBMr/p0T7UUNm mZnHD4U+mPgxD2d7hR2AtGCccAjX+pkrh2RhIv53ZaKblgo/xN1Bc3TN7Wd7B78Z4I/L4dXvZ Ij45tMBD24Fh+OdDuLBOEY6U2QuzHU3MLgLJQg== 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:106321 Archived-At: Eli Zaretskii writes: >> Well, inotify sends then the low-level event `delete-self', which is >> different from the usual `delete'. filenotify.el translates both to the >> upper-level event `deleted'. In case of `delete-self', filenotify.el >> could do something more, like removing the watch. Do we want this? > > I don't think filenotify.el should remove the watch on its own, but it > could send an event that would allow the application do that if it > wants to. I will think about. And check also what's possible with gfilenotify. >> I've tested for inotify, it works (confirmed by that user). The use case >> of that user was, that a file has been moved outside Emacs from one >> directory to the other. An he wanted to see it in both dired buffers, >> immediately. >> >> I couldn't test this for w32notify, but it should behave like this since >> Sunday. > > If you can show some simple test case, I can run it. Well, something like this: --8<---------------cut here---------------start------------->8--- (progn (require 'filenotify) (defalias 'myhandler1 'ignore) (defalias 'myhandler2 'ignore) (file-notify-add-watch "/tmp" '(change) 'myhandler1) (file-notify-add-watch "~/tmp" '(change) 'myhandler2) (trace-function 'file-notify-handle-event) (trace-function 'myhandler1) (trace-function 'myhandler2)) --8<---------------cut here---------------end--------------->8--- Then you do outside Emacs (inotify case): --8<---------------cut here---------------start------------->8--- # echo xxx >/tmp/xxx ====================================================================== 1 -> (file-notify-handle-event (file-notify (1 (create) "xxx" 0) file-notify-callback)) | 2 -> (myhandler1 ((1) created "/tmp/xxx")) | 2 <- myhandler1: nil 1 <- file-notify-handle-event: nil ====================================================================== 1 -> (file-notify-handle-event (file-notify (1 (modify) "xxx" 0) file-notify-callback)) | 2 -> (myhandler1 ((1) changed "/tmp/xxx")) | 2 <- myhandler1: nil 1 <- file-notify-handle-event: nil # mv /tmp/xxx ~/tmp/ ====================================================================== 1 -> (file-notify-handle-event (file-notify (1 (moved-from) "xxx" 49278) file-notify-callback)) 1 <- file-notify-handle-event: nil ====================================================================== 1 -> (file-notify-handle-event (file-notify (2 (moved-to) "xxx" 49278) file-notify-callback)) | 2 -> (myhandler1 ((1) renamed "/tmp/xxx" "/home/albinus/tmp/xxx")) | 2 <- myhandler1: nil | 2 -> (myhandler2 ((2) renamed "/tmp/xxx" "/home/albinus/tmp/xxx")) | 2 <- myhandler2: nil 1 <- file-notify-handle-event: nil --8<---------------cut here---------------end--------------->8--- That looks good. The same scenario for gfilenotify needs some improvements: --8<---------------cut here---------------start------------->8--- # echo xxx >/tmp/xxx ====================================================================== 1 -> (file-notify-handle-event (file-notify (3924112 created "/tmp/xxx") file-notify-callback)) | 2 -> (myhandler1 (3924112 created "/tmp/xxx")) | 2 <- myhandler1: nil | 2 -> (myhandler1 (3924112 created "/tmp/xxx")) | 2 <- myhandler1: nil 1 <- file-notify-handle-event: nil ====================================================================== 1 -> (file-notify-handle-event (file-notify (3924112 changed "/tmp/xxx") file-notify-callback)) | 2 -> (myhandler1 (3924112 changed "/tmp/xxx")) | 2 <- myhandler1: nil | 2 -> (myhandler1 (3924112 changed "/tmp/xxx")) | 2 <- myhandler1: nil 1 <- file-notify-handle-event: nil ====================================================================== 1 -> (file-notify-handle-event (file-notify (3924112 changes-done-hint "/tmp/xxx") file-notify-callback)) 1 <- file-notify-handle-event: nil # mv /tmp/xxx ~/tmp/ ====================================================================== 1 -> (file-notify-handle-event (file-notify (3924112 moved "/tmp/xxx" "/home/albinus/tmp/xxx") file-notify-callback)) | 2 -> (myhandler1 (3924112 renamed "/tmp/xxx" "/home/albinus/tmp/xxx")) | 2 <- myhandler1: nil | 2 -> (myhandler1 (3924112 renamed "/tmp/xxx" "/home/albinus/tmp/xxx")) | 2 <- myhandler1: nil 1 <- file-notify-handle-event: nil --8<---------------cut here---------------end--------------->8--- myhandler1 is always called twice (why?). And in the rename case, the call of myhandler2 is missing. Best regards, Michael.