bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21804: 25.0.50; file-notify-tests failure on Cygwin


From: Ken Brown
Subject: bug#21804: 25.0.50; file-notify-tests failure on Cygwin
Date: Mon, 26 Dec 2016 12:08:18 -0500
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

[Resending after unarchiving the bug.]


On 11/5/2015 2:58 PM, Michael Albinus wrote:
I've played with this the whole afternoon. Looks like there is no error
in gfilenotify for Cygwin. But it is a hard job to trigger the file
notification events to appear such a way they could be checked for
correctness in the test cases.

Increasing timeouts was necessary. But even this does not make the
events to appear reliably. One would need to write additional code to
get every single event one after the other. Waiting for a series of
events, as the test cases do expect, does not seem to work.

Hi Michael,

I've made some progress on understanding why some file notifications aren't triggered in the tests on Cygwin. One issue is that file-notify--test-read-event-timeout has to be increased drastically in order for `created' and `changed' events to be received. These can take 5 seconds or more.

A second issue is that a small delay is needed between the creation of a file watch and the beginning of file activity. This is not normally a problem in interactive sessions. But it can be observed in an interactive session by evaluating the following:

(require 'filenotify)
filenotify

(defun my-notify-callback (event)
   (message "Event %S" event))

(progn
   (file-notify-add-watch
    "/tmp/foo" '(change) 'my-notify-callback)
   (write-region "" nil "/tmp/foo"))

(delete-file "/tmp/foo")

;; The above yields `deleted' and `stopped' events, but no `created' event. Now we introduce a delay after adding the watch.

(progn
   (file-notify-add-watch
    "/tmp/foo" '(change) 'my-notify-callback)
   (sleep-for 1)
   (write-region "" nil "/tmp/foo"))

(delete-file "/tmp/foo")

;; This time we get the expected `created' event.

The attached patch takes care of both timing issues. With this patch, all the inexpensive file-notify tests pass on all my Cygwin systems.

Best regards,

Ken


Attachment: filenotify-tests.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]