Subject: Re: bug#22534: File notify broken on Windows

From: Fabrice Popineau <[email-masked]>
Date: Sun, 7 Feb 2016 20:34:10 +0100

2016-02-07 18:46 GMT+01:00 Eli Zaretskii <[email-masked]>:

> > From: Fabrice Popineau <[email-masked]>
> > Date: Sun, 7 Feb 2016 14:37:34 +0100
> > Cc: Michael Albinus <[email-masked]>, [email-masked]
> >
> > In the 'check for attribute change', I see only 2 'changed'
> notifications, and not 4
> > as expected by the test (around line 512: w32notify does not distinguish
> between
> > 'changed' and 'attribute-changed').
> >
> > So I need to apply :
> >
> > diff --git a/test/automated/file-notify-tests.el
> b/test/automated/file-notify-tests.el
> > index 5fc4ff8..943bd7e 100644
> > --- a/test/automated/file-notify-tests.el
> > +++ b/test/automated/file-notify-tests.el
> > @@ -507,7 +512,7 @@ file-notify--test-with-events
> > ;; w32notify does not distinguish between `changed' and
> > ;; `attribute-changed'.
> > ((string-equal (file-notify--test-library) "w32notify")
> > - '(changed changed changed changed))
> > + '(changed changed))
> > ;; For kqueue and in the remote case, `write-region'
> > ;; raises also an `attribute-changed' event.
> > ((or (string-equal (file-notify--test-library) "kqueue")
>
> Can you instrument filenotify.el to show the w32notify events this
> test generates, complete with the corresponding file names?  I will
> then compare to what I see here.
>
>
I printed the expected notifications and the ones that occur:

Library: `w32notify'
   passed  1/6  file-notify-test00-availability
   passed  2/6  file-notify-test01-add-watch
events: ((created changed deleted stopped)) ((17923488 created
c:/Users/Fabrice/AppData/Local/Temp/file-notify-test20748mQW) (17923488
changed c:/Users/Fabrice/AppData/Local/Temp/file-notify-test20748mQW)
(17923488 deleted
c:/Users/Fabrice/AppData/Local/Temp/file-notify-test20748mQW) (17923488
stopped c:/Users/Fabrice/AppData/Local/Temp/file-notify-test20748mQW))
events: ((changed changed deleted stopped)) ((17490424 changed
c:/Users/Fabrice/AppData/Local/Temp/file-notify-test20748zac) (17490424
changed c:/Users/Fabrice/AppData/Local/Temp/file-notify-test20748zac)
(17490424 deleted
c:/Users/Fabrice/AppData/Local/Temp/file-notify-test20748zac) (17490424
stopped c:/Users/Fabrice/AppData/Local/Temp/file-notify-test20748zac))
events: ((created changed deleted)) ((17491048 created
c:/Users/Fabrice/AppData/Local/Temp/file-notify-test-parent20748Ali/file-notify-test20748Nvo)
(17491048 changed
c:/Users/Fabrice/AppData/Local/Temp/file-notify-test-parent20748Ali/file-notify-test20748Nvo))
Test file-notify-test02-events backtrace:
  #[0 "\306\307\310C\307C\3111(\312\313\314\315$\317\"\32
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  ert-run-test([cl-struct-ert-test file-notify-test02-events "Check fi
  ert-run-or-rerun-test([cl-struct-ert--stats (not (tag :expensive-tes
  ert-run-tests((not (tag :expensive-test)) #[385 "\306\307\"\203G\2
  ert-run-tests-batch((not (tag :expensive-test)))
  ert-run-tests-batch-and-exit((not (tag :expensive-test)))
  eval((ert-run-tests-batch-and-exit (quote (not (tag :expensive-test)
  command-line-1(("-L" ";../../../emacs/test/automated" "-l" "ert" "-l
  command-line()
  normal-top-level()
Test file-notify-test02-events condition:
    (ert-test-failed
     ((should
       (dolist
           (elt events result)
         (setq result ...)))
      :form
      (let
          ((--dolist-tail-- events))
        (while --dolist-tail--
          (let ... ... ...))
        result)
      :value nil))
   FAILED  3/6  file-notify-test02-events
Reverting buffer `file-notify-test20748a5u'.
   passed  4/6  file-notify-test03-autorevert
events: ((changed changed deleted stopped)) ((19211556 changed
c:/Users/Fabrice/AppData/Local/Temp/file-notify-test20748ZNE) (19211556
changed c:/Users/Fabrice/AppData/Local/Temp/file-notify-test20748ZNE)
(19211556 deleted
c:/Users/Fabrice/AppData/Local/Temp/file-notify-test20748ZNE) (19211556
stopped c:/Users/Fabrice/AppData/Local/Temp/file-notify-test20748ZNE))
   passed  5/6  file-notify-test04-file-validity
   passed  6/6  file-notify-test05-dir-validity

> > For the rest of this test, whereas the test passes in interactive mode,
> it fails in batch mode with
> > several 'deleted' notifications. Namely, I need to apply the following
> for the test to pass.
>
> Does it help to add a call to
>
>   (read-event nil nil 0.1)
>
> after the code that invokes the deletion in each of these cases?
>

I have added this wait time after each delete-directory call in
file-notify-test02-events
with no difference.

I must add that the same test works interactively.
It is only in batch mode that I don't see the deleted notifications.

Fabrice