master a25d24b151b 1/2: Use proper inotifywait arguments in Tramp
Michael Albinus via Mailing list for Emacs changes <[email protected]>
| Newsgroups | gmane.emacs.diffs |
|---|---|
| Message-ID | <[email protected]> |
branch: master commit a25d24b151b986a4524700775a6860945e8c118e Author: Michael Albinus <[email protected]> Commit: Michael Albinus <[email protected]> Use proper inotifywait arguments in Tramp * lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch): Use -P and --format= arguments for inotifywait. (tramp-sh-inotifywait-process-filter): Read cookie. --- lisp/net/tramp-sh.el | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index f567a221342..8c4be32f9b2 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -3893,8 +3893,12 @@ Fall back to normal file name handler if no Tramp handler exists." "delete,delete_self")) ((memq 'attribute-change flags) "attrib")) events (concat events ",ignored,unmount") - ;; "-P" has been added to version 3.21, so we cannot assume it yet. - sequence `(,command "-mq" "-e" ,events ,localname) + ;; "-P" has been added to version 3.21. + ;; "%c" is not documented as format specifier, but it + ;; has been added to version 3.20 (likely), see + ;; <https://github.com/inotify-tools/inotify-tools/issues/72> + sequence `(,command "-mqP" "-e" ,events + "--format=%c %e %f" ,localname) ;; Make events a list of symbols. events (mapcar @@ -4038,7 +4042,7 @@ Fall back to normal file name handler if no Tramp handler exists." (dolist (line (split-string string (rx (+ (any "\r\n"))) 'omit)) ;; Check, whether there is a problem. (unless (string-match - (rx bol (+ (not blank)) (+ blank) (group (+ (not blank))) + (rx bol (group (+ (not blank))) (+ blank) (group (+ (not blank))) (? (+ blank) (group (+ (not (any "\r\n")))))) line) (tramp-error proc 'file-notify-error line)) @@ -4048,10 +4052,11 @@ Fall back to normal file name handler if no Tramp handler exists." proc (mapcar (lambda (x) (intern-soft (string-replace "_" "-" (downcase x)))) - (split-string (match-string 1 line) "," 'omit)) - (or (match-string 2 line) + (split-string (match-string 2 line) "," 'omit)) + (or (match-string 3 line) (file-name-nondirectory - (process-get proc 'tramp-watch-name)))))) + (process-get proc 'tramp-watch-name))) + (string-to-number (match-string 1 line) 16)))) ;; Add an Emacs event now. ;; `insert-special-event' exists since Emacs 31. (when (member (caadr object) events)