diff options
| author | Michael Albinus | 2019-06-14 19:45:00 +0200 |
|---|---|---|
| committer | Michael Albinus | 2019-06-14 19:45:00 +0200 |
| commit | 0518e3ca98e0d6d5d96323d4f4a2246b60fe28d9 (patch) | |
| tree | e39cc32c0e1c4874c3bb32d71e18f8e0bae59037 | |
| parent | 1d2e4d22c922f94d6f4b75a5ead18cbc679c5dfe (diff) | |
| download | emacs-0518e3ca98e0d6d5d96323d4f4a2246b60fe28d9.tar.gz emacs-0518e3ca98e0d6d5d96323d4f4a2246b60fe28d9.zip | |
Fix problem in remote file notification
* lisp/net/tramp-sh.el (tramp-sh-gio-monitor-process-filter)
(tramp-sh-gvfs-monitor-dir-process-filter)
(tramp-sh-inotifywait-process-filter): Do not kill the process.
Let `file-notify-rm-watch' do the job.
* test/lisp/filenotify-tests.el (file-notify-test03-events)
(file-notify-test05-file-validity)
(file-notify-test09-watched-file-in-watched-dir): Do not
special-case remote files.
| -rw-r--r-- | lisp/net/tramp-sh.el | 11 | ||||
| -rw-r--r-- | test/lisp/filenotify-tests.el | 29 |
2 files changed, 10 insertions, 30 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 3d572ad0b6d..d7db69a5ddb 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -3699,10 +3699,6 @@ Fall back to normal file name handler if no Tramp handler exists." | |||
| 3699 | (concat remote-prefix file) | 3699 | (concat remote-prefix file) |
| 3700 | (when file1 (concat remote-prefix file1))))) | 3700 | (when file1 (concat remote-prefix file1))))) |
| 3701 | (setq string (replace-match "" nil nil string)) | 3701 | (setq string (replace-match "" nil nil string)) |
| 3702 | ;; Remove watch when file or directory to be watched is deleted. | ||
| 3703 | (when (and (member (cl-caadr object) '(moved deleted)) | ||
| 3704 | (string-equal file (process-get proc 'watch-name))) | ||
| 3705 | (delete-process proc)) | ||
| 3706 | ;; Usually, we would add an Emacs event now. Unfortunately, | 3702 | ;; Usually, we would add an Emacs event now. Unfortunately, |
| 3707 | ;; `unread-command-events' does not accept several events at | 3703 | ;; `unread-command-events' does not accept several events at |
| 3708 | ;; once. Therefore, we apply the handler directly. | 3704 | ;; once. Therefore, we apply the handler directly. |
| @@ -3754,10 +3750,6 @@ file-notify events." | |||
| 3754 | (concat remote-prefix file) | 3750 | (concat remote-prefix file) |
| 3755 | (when file1 (concat remote-prefix file1))))) | 3751 | (when file1 (concat remote-prefix file1))))) |
| 3756 | (setq string (replace-match "" nil nil string)) | 3752 | (setq string (replace-match "" nil nil string)) |
| 3757 | ;; Remove watch when file or directory to be watched is deleted. | ||
| 3758 | (when (and (member (cl-caadr object) '(moved deleted)) | ||
| 3759 | (string-equal file (process-get proc 'watch-name))) | ||
| 3760 | (delete-process proc)) | ||
| 3761 | ;; Usually, we would add an Emacs event now. Unfortunately, | 3753 | ;; Usually, we would add an Emacs event now. Unfortunately, |
| 3762 | ;; `unread-command-events' does not accept several events at | 3754 | ;; `unread-command-events' does not accept several events at |
| 3763 | ;; once. Therefore, we apply the handler directly. | 3755 | ;; once. Therefore, we apply the handler directly. |
| @@ -3794,9 +3786,6 @@ file-notify events." | |||
| 3794 | (replace-regexp-in-string "_" "-" (downcase x)))) | 3786 | (replace-regexp-in-string "_" "-" (downcase x)))) |
| 3795 | (split-string (match-string 1 line) "," 'omit)) | 3787 | (split-string (match-string 1 line) "," 'omit)) |
| 3796 | (match-string 3 line)))) | 3788 | (match-string 3 line)))) |
| 3797 | ;; Remove watch when file or directory to be watched is deleted. | ||
| 3798 | (when (member (cl-caadr object) '(move-self delete-self ignored)) | ||
| 3799 | (delete-process proc)) | ||
| 3800 | ;; Usually, we would add an Emacs event now. Unfortunately, | 3789 | ;; Usually, we would add an Emacs event now. Unfortunately, |
| 3801 | ;; `unread-command-events' does not accept several events at | 3790 | ;; `unread-command-events' does not accept several events at |
| 3802 | ;; once. Therefore, we apply the handler directly. | 3791 | ;; once. Therefore, we apply the handler directly. |
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 9dfa794e307..4396a693e3a 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el | |||
| @@ -687,12 +687,11 @@ delivered." | |||
| 687 | ((getenv "EMACS_EMBA_CI") | 687 | ((getenv "EMACS_EMBA_CI") |
| 688 | '(created changed deleted)) | 688 | '(created changed deleted)) |
| 689 | ;; There are two `deleted' events, for the file and for | 689 | ;; There are two `deleted' events, for the file and for |
| 690 | ;; the directory. Except for cygwin, kqueue and remote | 690 | ;; the directory. Except for cygwin and kqueue. And |
| 691 | ;; files. And cygwin does not raise a `changed' event. | 691 | ;; cygwin does not raise a `changed' event. |
| 692 | ((eq system-type 'cygwin) | 692 | ((eq system-type 'cygwin) |
| 693 | '(created deleted stopped)) | 693 | '(created deleted stopped)) |
| 694 | ((or (string-equal (file-notify--test-library) "kqueue") | 694 | ((string-equal (file-notify--test-library) "kqueue") |
| 695 | (file-remote-p temporary-file-directory)) | ||
| 696 | '(created changed deleted stopped)) | 695 | '(created changed deleted stopped)) |
| 697 | (t '(created changed deleted deleted stopped))) | 696 | (t '(created changed deleted deleted stopped))) |
| 698 | (write-region | 697 | (write-region |
| @@ -743,9 +742,6 @@ delivered." | |||
| 743 | ;; directory are not detected. | 742 | ;; directory are not detected. |
| 744 | ((getenv "EMACS_EMBA_CI") | 743 | ((getenv "EMACS_EMBA_CI") |
| 745 | '(created changed created changed deleted deleted)) | 744 | '(created changed created changed deleted deleted)) |
| 746 | ;; Remote files return two `deleted' events. | ||
| 747 | ((file-remote-p temporary-file-directory) | ||
| 748 | '(created changed created changed deleted deleted stopped)) | ||
| 749 | (t '(created changed created changed | 745 | (t '(created changed created changed |
| 750 | deleted deleted deleted stopped))) | 746 | deleted deleted deleted stopped))) |
| 751 | (write-region | 747 | (write-region |
| @@ -795,13 +791,12 @@ delivered." | |||
| 795 | ((getenv "EMACS_EMBA_CI") | 791 | ((getenv "EMACS_EMBA_CI") |
| 796 | '(created changed renamed deleted)) | 792 | '(created changed renamed deleted)) |
| 797 | ;; There are two `deleted' events, for the file and for | 793 | ;; There are two `deleted' events, for the file and for |
| 798 | ;; the directory. Except for cygwin, kqueue and remote | 794 | ;; the directory. Except for cygwin and kqueue. And |
| 799 | ;; files. And cygwin raises `created' and `deleted' | 795 | ;; cygwin raises `created' and `deleted' events instead |
| 800 | ;; events instead of a `renamed' event. | 796 | ;; of a `renamed' event. |
| 801 | ((eq system-type 'cygwin) | 797 | ((eq system-type 'cygwin) |
| 802 | '(created created deleted deleted stopped)) | 798 | '(created created deleted deleted stopped)) |
| 803 | ((or (string-equal (file-notify--test-library) "kqueue") | 799 | ((string-equal (file-notify--test-library) "kqueue") |
| 804 | (file-remote-p temporary-file-directory)) | ||
| 805 | '(created changed renamed deleted stopped)) | 800 | '(created changed renamed deleted stopped)) |
| 806 | (t '(created changed renamed deleted deleted stopped))) | 801 | (t '(created changed renamed deleted deleted stopped))) |
| 807 | (write-region | 802 | (write-region |
| @@ -1046,12 +1041,11 @@ delivered." | |||
| 1046 | '((deleted stopped) | 1041 | '((deleted stopped) |
| 1047 | (created deleted stopped))) | 1042 | (created deleted stopped))) |
| 1048 | ;; There are two `deleted' events, for the file and for | 1043 | ;; There are two `deleted' events, for the file and for |
| 1049 | ;; the directory. Except for cygwin, kqueue and remote | 1044 | ;; the directory. Except for cygwin and kqueue. And |
| 1050 | ;; files. And cygwin does not raise a `changed' event. | 1045 | ;; cygwin does not raise a `changed' event. |
| 1051 | ((eq system-type 'cygwin) | 1046 | ((eq system-type 'cygwin) |
| 1052 | '(created deleted stopped)) | 1047 | '(created deleted stopped)) |
| 1053 | ((or (string-equal (file-notify--test-library) "kqueue") | 1048 | ((string-equal (file-notify--test-library) "kqueue") |
| 1054 | (file-remote-p temporary-file-directory)) | ||
| 1055 | '(created changed deleted stopped)) | 1049 | '(created changed deleted stopped)) |
| 1056 | (t '(created changed deleted deleted stopped))) | 1050 | (t '(created changed deleted deleted stopped))) |
| 1057 | (write-region | 1051 | (write-region |
| @@ -1415,9 +1409,6 @@ the file watch." | |||
| 1415 | ;; directory are not detected. | 1409 | ;; directory are not detected. |
| 1416 | ((getenv "EMACS_EMBA_CI") | 1410 | ((getenv "EMACS_EMBA_CI") |
| 1417 | '()) | 1411 | '()) |
| 1418 | ;; Remote files send just one `stopped' event. | ||
| 1419 | ((file-remote-p temporary-file-directory) | ||
| 1420 | '(stopped)) | ||
| 1421 | (t '(deleted stopped)))))) | 1412 | (t '(deleted stopped)))))) |
| 1422 | (delete-directory file-notify--test-tmpfile 'recursive)) | 1413 | (delete-directory file-notify--test-tmpfile 'recursive)) |
| 1423 | (unless (getenv "EMACS_EMBA_CI") | 1414 | (unless (getenv "EMACS_EMBA_CI") |