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

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

bug#22454: 24.5; win32 file-notify, input events caused by updates to ot


From: Noam Postavsky
Subject: bug#22454: 24.5; win32 file-notify, input events caused by updates to other (non-watched) files
Date: Sun, 24 Jan 2016 03:10:38 -0500

Save the lisp code below to a file in a git checkout, and run it with
'emacs -Q -l file-notify-and-sit-for-test.el'.  It causes Emacs to get
stuck in an infinite loop (you can exit with C-g).  It seems that the
'git update-index --refresh' writes to somes files in .git/ which
triggers a file notify event (even though Emacs is not watching those
files).  This causes 'sit-for' to return immediately, and the
process-status of 'git --version' never gets set to 'exit' (even though
the actual process does exit quickly).

This does not occur on GNU/Linux systems.  I'm not sure if it should
be considered a bug, or just an inherent limitation of Windows' file
notification API.

The original context for this was a magit bug, since fixed by changing
to sleep-for (and hopefully will soon be better fixed by using
call-process-region instead of start-process + busy wait):
https://github.com/magit/magit/issues/2454


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Begin file-notify-and-sit-for-test.el
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'filenotify)

;; simulate the problematic effect of `global-auto-revert-mode'
(file-notify-add-watch load-file-name '(change) #'ignore)

(call-process "git" nil nil nil "update-index" "--refresh")

(let ((proc (start-process "git version" nil "git" "--version")))
  (message "waiting for %s" (process-id proc))
  (while (eq (process-status proc) 'run)
    (sit-for 0.1)
    (message "waiting for %s" (process-id proc))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; End file-notify-and-sit-for-test.el
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;





reply via email to

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