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#22557: 25.0.90; Saving a buffer under auto-revert turns off file notifications Date: Fri, 05 Feb 2016 13:24:01 +0100 Message-ID: <87y4azs5um.fsf@gmx.de> References: <83a8ngwcil.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1454675130 16005 80.91.229.3 (5 Feb 2016 12:25:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Feb 2016 12:25:30 +0000 (UTC) Cc: 22557@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 05 13:25:15 2016 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 1aRfRq-0004en-U1 for geb-bug-gnu-emacs@m.gmane.org; Fri, 05 Feb 2016 13:25:15 +0100 Original-Received: from localhost ([::1]:47826 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRfRl-0002ob-13 for geb-bug-gnu-emacs@m.gmane.org; Fri, 05 Feb 2016 07:25:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRfRh-0002nD-3J for bug-gnu-emacs@gnu.org; Fri, 05 Feb 2016 07:25:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRfRd-0005up-T5 for bug-gnu-emacs@gnu.org; Fri, 05 Feb 2016 07:25:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRfRd-0005uc-Ps for bug-gnu-emacs@gnu.org; Fri, 05 Feb 2016 07:25:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aRfRd-0002B6-JY for bug-gnu-emacs@gnu.org; Fri, 05 Feb 2016 07:25:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <83a8ngwcil.fsf@gnu.org> Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Feb 2016 12:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22557 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22557-submit@debbugs.gnu.org id=B22557.14546750538311 (code B ref 22557); Fri, 05 Feb 2016 12:25:01 +0000 Original-Received: (at 22557) by debbugs.gnu.org; 5 Feb 2016 12:24:13 +0000 Original-Received: from localhost ([127.0.0.1]:32863 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aRfQr-00029z-5P for submit@debbugs.gnu.org; Fri, 05 Feb 2016 07:24:13 -0500 Original-Received: from mout.gmx.net ([212.227.17.22]:54650) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aRfQp-00029m-0z for 22557@debbugs.gnu.org; Fri, 05 Feb 2016 07:24:11 -0500 Original-Received: from detlef.gmx.de ([87.146.56.6]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0MfzEP-1ae5c91QnN-00NOb1; Fri, 05 Feb 2016 13:24:04 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.90 (gnu/linux) X-Provags-ID: V03:K0:wo6/SE7a9x0/H8s5qm2xV+19HydK4U8gRBF84TzfK10VI7ohb4S hk/M4rlpXNkc0F3t5RqrjqF4ph+7T7gLv5c+d2Fi+YlCj996YjSXwxgY9+J2HjLSMmvxUKg N4ijhHiB4duHdnJnJ1q4iF49rKI2jxXeJ5wVqIDHzCVO97C1LCn9B5ts4FQZeaBEBxn+C8v mQ4F2iUwk6EVdTflFt4lg== X-UI-Out-Filterresults: notjunk:1;V01:K0:o+p3CK+CQWE=:9TbnCc7Kr4CB1Q6Eefvjzv QidGbKZ4uZD6Y0Ocq3aAarWsbkCCpDZdlSWnei3rmnoZgRyxjMG/LQwvzeIES4/1YSin4NOqH Wa8jlMyvMDllIDnxELJHHZY8duzMBvmXayaHuOuKCknSGsYkBeR5uyzPLBNQ1rq6c3G9YFD1L CSzBfUMUeDBOP9DFQ45LbqmeSp4qQxl65kNKGW5exS0MD5YXzPRdqKatbhw1IZs00CmjilhJR jNs2OSEiXoHZBLdEycPskjv2lb//7t3Knje1oWkX595hQSNRtQGlEZCROehNeSVMAYGsg88Bc RV2ebBofTXQ1dxivM9SfdY/7QCq3FfVndETZVEFE7VU/+ecHNga/8fb1T2JXY5iggAVMe41uM m9BFmGzzkvFvfau7kxA6HhoMMoRMRJP9qV0aD/pwkAsv1v9gdUQCPotoL6Rfny6TqqhH+XqpY Vlqs4AcWmCnARbrLELQIAE4Oym/gWJ1sX6Q2Fr0jNDKy9WGCNLA42pnfQsMNxkFHLRfnC61M7 u964dm8R+j/7+Ewd/YT0Geo0JMbpnSOgkzEGTg+g4bNJ1lsjb9/HX7ujB5Y68twgG+WWiUtOO SESR6XWeeaDu9AwFXTkhWqMZbaR/bN2XzIieAeQbSnsK/CvEGAygbqe4xYcEXOGr5ZjT9jIn6 xPuAnkXD08WsHg0HsUKaXqrRugAtKhnptikwk71mq6MVmDNm60mB8Vbzy4NF7sxa+NvRiDh1s ZvKgunlKFjy7mT4yggiPidTN0nIZeYt4EwohKhzWt24mWahDVCiWvTr5bwoqOKb7uI2n8jN5 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:112486 Archived-At: Eli Zaretskii writes: Hi Eli, > emacs -Q > C-x C-f SOME-FILE RET > M-x auto-revert-mode RET > M-: auto-revert-use-notify RET => t > > Modify the buffer and save it with "C-x C-s". Then: > > M-: auto-revert-use-notify RET => nil > > This is on MS-Windows; the same recipe on GNU/Linux with inotify > doesn't have this problem. For me the recipe fails in both cases. This is due to `backup-by-copying' being nil; in case of t there's no problem. But it shall work independent of this setting. This calls for a new test case in test/automated/file-notify-tests.el. Will add it. > Looking under the hood reveals that filenotify.el sends a 'stopped' > notification when Emacs renames SOME-FILE to SOME-FILE~, to back it > up. In response, auto-revert-mode turns off file notifications and > falls back to polling. > > It looks like the reason is this condition in filenotify.el: > > ;; Check for stopped. > (setq > stopped > (or > stopped > (and > (memq action '(deleted renamed)) > (= (length (cdr registered)) 1) > (or > (string-equal > (file-name-nondirectory file) > (file-name-nondirectory (car registered))) > (string-equal > (file-name-nondirectory file) > (car (cadr registered))))))) > > The second call to string-equal is the culprit: the file names match, > so 'stopped' gets a non-nil value. `stopped' shall be raised only in case of `deleted'. For `renamed', it seems to be wrong. Will check. > I don't understand the logic of this: at least with w32notify, when a > file is in auto-revert-mode, we watch the entire parent directory of > that file, so there's no need to send the 'stopped' event when the > file is renamed or deleted, only when the parent directory is deleted. In `auto-revert-notify-add-watch', only the file named by `buffer-file-name' is watched. autorevert.el does not check, what the underlying library of filenotify.el is able to do, watching single files or whole directories. And as said, a renaming of a file should not turn file notifications off. I will try to fix this. > This second call to string-equal was added as part of kqueue > back-port, but it affects all the backends, and there's no comment or > anything in the log message that explains the rationale for this part > of the change, only a laconic "Add kqueue support." The changes were introduced in the scratch/kqueue branch. Later merged to the master branch, later backported to the emacs-25 branch. Likely, commit messages were lost this way. I really hate it that we have no ChangeLog anymore, maintained by the developers. > What is the reason for this test, and should it perhaps be limited to > kqueue? Nope. If a file is supervised, and this is deleted on purpose, it shouldn't come back under supervision if a file with the same name appears later on. There is the case of renaming files during backup, which could be seen internally as delete+create file notification actions. This must be handled, I agree. Best regards, Michael.