all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 21435@debbugs.gnu.org, tsdh@gnu.org
Subject: bug#21435: 25.0.50; file-notify has problems after renames
Date: Thu, 10 Sep 2015 20:20:54 +0200	[thread overview]
Message-ID: <87twr29lvd.fsf@gmx.de> (raw)
In-Reply-To: <83wpvy40fa.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 10 Sep 2015 21:03:05 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> > However, if all we want is to make sure the destination directory gets
>> > a notification (so it could auto-revert), then this already happens on
>> > MS-Windows (see the 'created' event above), and therefore nothing
>> > should be done on Windows to support the user request above.
>> 
>> It's not only the destination directory, it's also the source directory
>> which matters. Remember the initial use case, two dired buffers under
>> `auto-revert-mode' control. The moved file must appear in the
>> destination dired buffer, and it must disappear in the source dired buffer.
>
> Yes, and both events happen in this scenario, on Windows as well as on
> GNU/Linux.  So the fact that the move is not reported as a move will
> not cause any problems in this use case.

For that dired case, yes. I was answering to your statement "if all we
want is to make sure the destination directory ..."

>> Not necessary I believe. Due to inotify cookie mechanism, it will work
>> robustly. And don't forget gfilenotify, which sends a `rename' event
>> already on low-level.
>
> I'm guessing that gfilenotify only does that when its back-end is
> inotify.  E.g., I doubt that it could do this when it uses its
> fallback polling method.

Maybe, I haven't checked. But the point is that we send a `renamed'
event only we can trust there is a file move. Otherwise, we send
`deleted' and `created'.

>> >  . I'm not sure this kind of non-trivial logic is something that
>> >    belongs to filenotify.el; it could well have a better place in
>> >    auto-revert.el instead, as that is the level where the logic is
>> >    needed and understood, or even in the Dired-specific function that
>> >    auto-reverts a directory
>> 
>> If we only deliver `removed' and `created' events, none of those
>> libraries would have a chance to pair them to a rename action.
>
> They shouldn't rely on that in the first place, since this is
> unreliable, as we just saw.

Nope. When filenotify.el sends a `renamed' event, it must be
reliable. Because we got it from gfilenotify, because we could pair the
events via inotify cookies, whatever. When it is not reliable, we send
`deleted' and `created', which has less semantics than `renamed'.

> And in the case in point, it's unnecessary anyway, since all you need
> is to have events in both source and destination.  These events do not
> have to be 'rename' events.

In the use cases we know today, you are right. But there might be other
use cases where it matters. And again, `renamed' events provide more
information than single `deleted' and `created' events.

>> Essential information, like inotify cookies, will be lost.
>
> On filenotify.el level, yes.  I thought filenotify.el exists to try to
> present a more or less unified interface independent of the back-end.
> If such differences in back-end behavior are seen by clients of
> filenotify.el, then how is it different from invoking the back-end
> directly?

There is already a difference: native gfilenotify gives us a `rename'
event. Shall we convert it to `deleted' and `created'? This would reduce
the information.

>> And yes, this information will be needed. Recently, I saw a discussion
>> on sx, whether Emacs' `auto.revert-mode' could also support file
>> renaming. That is, when a buffer is associated by a file, and that file
>> is renamed outside Emacs, Emacs shall rename `buffer-name' and
>> `buffer-file-name', and then revert. Nice idea ...
>
> The problem we are discussing does not exist in this scenario, AFAIU.

That scenario would work only if there is a `renamed' event. How else
autorevert could decide, that a file has been moved? What is its new name?

Best regards, Michael.





  reply	other threads:[~2015-09-10 18:20 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-08  8:47 bug#21435: 25.0.50; file-notify has problems after renames Tassilo Horn
2015-09-08 16:03 ` Eli Zaretskii
2015-09-08 18:04   ` Michael Albinus
2015-09-08 18:21     ` Eli Zaretskii
2015-09-08 19:28       ` Tassilo Horn
2015-09-09 18:15         ` Michael Albinus
2015-09-09 19:01           ` Tassilo Horn
2015-09-09 20:23             ` Tassilo Horn
2015-09-10 11:23               ` Michael Albinus
2015-09-10 15:31                 ` Tassilo Horn
2015-09-10 17:50                   ` Michael Albinus
2015-09-10 19:22                     ` Tassilo Horn
2015-09-11  9:53                       ` Michael Albinus
2015-09-11 12:17                         ` Tassilo Horn
2015-09-11 12:32                           ` Eli Zaretskii
2015-09-12  8:44                           ` Michael Albinus
2015-09-11  9:45                     ` Michael Albinus
2015-09-11 12:11                       ` Tassilo Horn
2015-09-09 18:41       ` Michael Albinus
2015-09-09 19:21         ` Eli Zaretskii
2015-09-10 11:09           ` Michael Albinus
2015-09-10 15:45             ` Eli Zaretskii
2015-09-10 17:37               ` Michael Albinus
2015-09-10 18:03                 ` Eli Zaretskii
2015-09-10 18:20                   ` Michael Albinus [this message]
2015-09-10 18:55                     ` Eli Zaretskii
2015-09-11 12:51                       ` Michael Albinus
2015-09-08 19:05   ` Tassilo Horn
2015-09-08 19:19     ` Eli Zaretskii
2015-09-08 19:47       ` Tassilo Horn
2015-09-09  2:39         ` Eli Zaretskii
2015-09-09  6:13           ` Tassilo Horn
2015-09-20 17:26 ` Michael Albinus
2015-09-20 19:36   ` Eli Zaretskii
2015-09-21  6:25     ` Michael Albinus
2015-09-21  7:54       ` Eli Zaretskii
2015-09-21 10:13         ` Michael Albinus
2015-09-21 10:14           ` Eli Zaretskii
2015-09-21 13:11             ` Michael Albinus
2015-09-21 13:31               ` Eli Zaretskii
2015-09-21 13:38                 ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87twr29lvd.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=21435@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=tsdh@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.