all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Tassilo Horn <tsdh@gnu.org>
Cc: 21435@debbugs.gnu.org
Subject: bug#21435: 25.0.50; file-notify has problems after renames
Date: Thu, 10 Sep 2015 13:23:50 +0200	[thread overview]
Message-ID: <87oahatt4p.fsf@gmx.de> (raw)
In-Reply-To: <871te7tk9i.fsf@gnu.org> (Tassilo Horn's message of "Wed, 09 Sep 2015 22:23:05 +0200")

Tassilo Horn <tsdh@gnu.org> writes:

Hi Tassilo,

> Ok, I gave it a whirl and now the `file-notify--test-event-handler' also
> records all events in a new variable `file-notify--test-events' for
> later analysis.  `file-notify-test02-events' now uses that feature to
> check if the received events are the expected ones in the expected
> order.
>
> That already revealed two problems:
>
>   1. Now `file-notify-test02-events-remote' fails because after every
>      expected `changed' event an additional `attribute-changed' event is
>      received.  This is wrong because when adding the watch, only
>      '(change) is given as FLAGS argument, not '(change
>      attribute-change).

I'll contact the Tramp maintainer about :-)

>   2. When I change the watch FLAGS to '(change attribute-change), there
>      are still no attribute-changed events received in the local case.

attribute-change happens when you change file permissions, or
modification time w/o changing the file contents. Something like

--8<---------------cut here---------------start------------->8---
(progn
  (require 'filenotify)
  (defalias 'myhandler 'ignore)
  (file-notify-add-watch "/tmp" '(change attribute-change) 'myhandler)
  (trace-function 'file-notify-handle-event)
  (trace-function 'myhandler))

# echo xxx > /tmp/xxx

======================================================================
1 -> (file-notify-handle-event (file-notify (1 (create) "xxx" 0) file-notify-callback))
| 2 -> (myhandler ((1) created "/tmp/xxx"))
| 2 <- myhandler: nil
1 <- file-notify-handle-event: nil
======================================================================
1 -> (file-notify-handle-event (file-notify (1 (modify) "xxx" 0) file-notify-callback))
| 2 -> (myhandler ((1) changed "/tmp/xxx"))
| 2 <- myhandler: nil
1 <- file-notify-handle-event: nil

# chmod 777 /tmp/xxx

======================================================================
1 -> (file-notify-handle-event (file-notify (1 (attrib) "xxx" 0) file-notify-callback))
| 2 -> (myhandler ((1) attribute-changed "/tmp/xxx"))
| 2 <- myhandler: nil
1 <- file-notify-handle-event: nil

# touch /tmp/xxx

======================================================================
1 -> (file-notify-handle-event (file-notify (1 (attrib) "xxx" 0) file-notify-callback))
| 2 -> (myhandler ((1) attribute-changed "/tmp/xxx"))
| 2 <- myhandler: nil
1 <- file-notify-handle-event: nil
--8<---------------cut here---------------end--------------->8---

> And a question: Will the events read by `file-notify--wait-for-events'
> still be processed by the handler function?

Yes, they should.

> And what's the intention of (file-notify--wait-for-events 5
> file-notify--test-results)?  The timeout of 5 is reasonable, but the
> UNTIL argument here just defines that it waits until the very first of
> possibly up to nine yet missing events is awaited here, or do I get
> something wrong?

Well, this is an open point here. When waiting for events, you don't
know how many events will arrive for a given file operation. See the
first command above, "echo", it is good for 2 events.

So I've taken this heuristics, that after arrival of the first event the
other ones will arrive soon. I simply don't know better ...

gfilenotify could profit from the changes-done-hint event, which is
exactly this kind of information. But we don't have a similar mechanism
for inotify or w32notify, as far as I'm aware.

If you know of a better check for "alle events we wait for have arrived"
- go on.

> Bye,
> Tassilo

Best regards, Michael.





  reply	other threads:[~2015-09-10 11:23 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 [this message]
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
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=87oahatt4p.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=21435@debbugs.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.