From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: File watch support in autorevert.el Date: Fri, 11 Jan 2013 17:57:52 +0200 Message-ID: <83vcb3u2yn.fsf@gnu.org> References: <878v819kok.fsf@gmx.de> <83fw28uj9c.fsf@gnu.org> <87ip73n3xl.fsf@gmx.de> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1357919864 21972 80.91.229.3 (11 Jan 2013 15:57:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Jan 2013 15:57:44 +0000 (UTC) Cc: emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 11 16:58:01 2013 Return-path: Envelope-to: ged-emacs-devel@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 1TtgzW-0003q5-KO for ged-emacs-devel@m.gmane.org; Fri, 11 Jan 2013 16:57:58 +0100 Original-Received: from localhost ([::1]:40861 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtgzG-0004Eo-M1 for ged-emacs-devel@m.gmane.org; Fri, 11 Jan 2013 10:57:42 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:44294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttgz8-0004EG-9q for emacs-devel@gnu.org; Fri, 11 Jan 2013 10:57:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ttgz6-0007iX-Oe for emacs-devel@gnu.org; Fri, 11 Jan 2013 10:57:34 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:45070) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttgz6-0007iN-Fb for emacs-devel@gnu.org; Fri, 11 Jan 2013 10:57:32 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MGG00C00WUDFN00@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Fri, 11 Jan 2013 17:57:31 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MGG00CA2XNU68C0@a-mtaout22.012.net.il>; Fri, 11 Jan 2013 17:57:31 +0200 (IST) In-reply-to: <87ip73n3xl.fsf@gmx.de> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.172 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:156225 Archived-At: > From: Michael Albinus > Cc: emacs-devel@gnu.org > Date: Fri, 11 Jan 2013 16:18:46 +0100 > > Eli Zaretskii writes: > > > . The code as written is too naive: it blindly assumes that every > > single notification reported by the filesystem for a given watch is > > necessarily the one requested in the auto-revert-notify-add-watch > > call. But that assumption is false, at least on Windows, where the > > implementation actually watches events to the entire parent > > directory of the file we are interested in. So Emacs reverts the > > file whenever _any_ file in the same directory was changed. I > > believe similar problems can happen with inotify, albeit much more > > rarely. For that reason, I think auto-revert-notify-handler should > > filter events by ASPECTS/ACTION member, and on Windows also by FILE > > member of the event. > > Will do for the inotify case. It is a simple bit easier, because you can > install a file watch for exactly one file, and you can expect it returns > for that file only. You cannot expect that, not in general, because there's no such promise in the docs of these interfaces. That's why the interface returns to you the full information about the transaction. I don't think it's wise to ignore that information. > > . It isn't clear to me that using IN_CLOSE_WRITE with inotify is TRT: > > AFAIU, that would mean we only revert a file when the application > > writing to it closes its descriptor. IOW, if the application makes > > several changes to the file during a prolonged operation, and > > doesn't close and reopen the file in between, we will only see the > > changes at the end, but not during the operation. Wouldn't it be > > better to use IN_MODIFY instead? > > See my other message. I believe IN_CLOSE_WRITE is sufficient for the > inotify case, but I might be wrong. I would need a test case which shows > it. Since the documentation clearly says this event is generated when the file is _closed_, I wonder why a test case is needed. > > . At least on Windows, turning on auto-revert-mode and then modifying > > and saving the file announces that it was auto-reverted. This > > didn't happen with the auto-revert method that doesn't use file > > notifications. Is this a bug? > > I have an old Emacs instance, w/o support of inotify in > autorevert.el. There I see the same message. I don't see this in Emacs 24.2.92 on Windows.