Fix Bug#33735
* lisp/net/tramp-sh.el (tramp-sh-gio-monitor-process-filter): Delete empty lines. (Bug#33735) (tramp-sh-inotifywait-process-filter): Use `string-match'. (tramp-set-remote-path): Check for PIPE_BUF but PATH_MAX. * test/lisp/filenotify-tests.el: Handle $REMOTE_FILE_NOTIFY_LIBRARY. (file-notify--deftest-remote): Suppress vc-handled-backends. (file-notify-test08-backup): Do not expect failure on hydra. (Bug#33735).
This commit is contained in:
parent
f1faf85f00
commit
452d0c52cd
3 changed files with 37 additions and 13 deletions
|
@ -264,6 +264,7 @@ If NAME is a remote file name, the local part of NAME is unquoted."
|
|||
A nil value for either argument stands for the current time."
|
||||
(equal (or t1 (current-time)) (or t2 (current-time)))))
|
||||
|
||||
;; `flatten-tree' has appeared in Emacs 27.1.
|
||||
(if (fboundp 'flatten-tree)
|
||||
(defalias 'tramp-compat-flatten-tree 'flatten-tree)
|
||||
(defun tramp-compat-flatten-tree (tree)
|
||||
|
|
|
@ -3615,11 +3615,14 @@ Fall back to normal file name handler if no Tramp handler exists."
|
|||
(string-match-p "Monitoring not supported\\|No locations given" string)
|
||||
(delete-process proc))
|
||||
|
||||
;; Delete empty lines.
|
||||
(setq string (replace-regexp-in-string "\n\n" "\n" string))
|
||||
|
||||
(while (string-match
|
||||
(eval-when-compile
|
||||
(concat "^[^:]+:"
|
||||
"[[:space:]]\\([^:]+\\):"
|
||||
"[[:space:]]" (regexp-opt tramp-gio-events t)
|
||||
"[[:space:]]" (regexp-opt tramp-gio-events t)
|
||||
"\\([[:space:]]\\([^:]+\\)\\)?$"))
|
||||
string)
|
||||
|
||||
|
@ -3713,7 +3716,7 @@ file-notify events."
|
|||
(tramp-message proc 6 "%S\n%s" proc string)
|
||||
(dolist (line (split-string string "[\n\r]+" 'omit))
|
||||
;; Check, whether there is a problem.
|
||||
(unless (string-match-p
|
||||
(unless (string-match
|
||||
(eval-when-compile
|
||||
(concat "^[^[:blank:]]+"
|
||||
"[[:blank:]]+\\([^[:blank:]]+\\)+"
|
||||
|
@ -3880,6 +3883,9 @@ This function expects to be in the right *tramp* buffer."
|
|||
(setq result (buffer-substring (point) (point-at-eol)))))
|
||||
result)))
|
||||
|
||||
;; On hydra.nixos.org, the $PATH environment variable is too long to
|
||||
;; send it. This is likely not due to PATH_MAX, but PIPE_BUF. We
|
||||
;; check it, and use a temporary file in case of. See Bug#33781.
|
||||
(defun tramp-set-remote-path (vec)
|
||||
"Sets the remote environment PATH to existing directories.
|
||||
I.e., for each directory in `tramp-remote-path', it is tested
|
||||
|
@ -3888,12 +3894,12 @@ variable PATH."
|
|||
(let ((command
|
||||
(format "PATH=%s; export PATH"
|
||||
(mapconcat 'identity (tramp-get-remote-path vec) ":")))
|
||||
(path-max
|
||||
(with-tramp-connection-property vec "path-max"
|
||||
(tramp-send-command-and-read vec "getconf PATH_MAX /")))
|
||||
(pipe-buf
|
||||
(with-tramp-connection-property vec "pipe-buf"
|
||||
(tramp-send-command-and-read vec "getconf PIPE_BUF /")))
|
||||
tmpfile)
|
||||
(tramp-message vec 5 "Setting $PATH environment variable")
|
||||
(if (< (length command) path-max)
|
||||
(if (< (length command) pipe-buf)
|
||||
(tramp-send-command vec command)
|
||||
;; Use a temporary file.
|
||||
(setq tmpfile (tramp-make-tramp-temp-file vec))
|
||||
|
@ -5785,10 +5791,6 @@ function cell is returned to be applied on a buffer."
|
|||
;; gets confused about the file locking status. Try to find out why
|
||||
;; the workaround doesn't work.
|
||||
;;
|
||||
;; * Allow out-of-band methods as _last_ multi-hop. Open a connection
|
||||
;; until the last but one hop via `start-file-process'. Apply it
|
||||
;; also for ftp and smb.
|
||||
;;
|
||||
;; * WIBNI if we had a command "trampclient"? If I was editing in
|
||||
;; some shell with root privileges, it would be nice if I could
|
||||
;; just call
|
||||
|
|
|
@ -31,6 +31,21 @@
|
|||
;; remote host, set this environment variable to "/dev/null" or
|
||||
;; whatever is appropriate on your system.
|
||||
|
||||
;; For the remote file-notify library, Tramp checks for the existence
|
||||
;; of a respective command. The first command found is used. In
|
||||
;; order to use a dedicated one, the environment variable
|
||||
;; $REMOTE_FILE_NOTIFY_LIBRARY shall be set, possible values are
|
||||
;; "inotifywait", "gio-monitor" and "gvfs-monitor-dir".
|
||||
|
||||
;; Local file-notify libraries are auto-detected during Emacs
|
||||
;; configuration. This can be changed with a respective configuration
|
||||
;; argument, like
|
||||
;;
|
||||
;; --with-file-notification=inotify
|
||||
;; --with-file-notification=kqueue
|
||||
;; --with-file-notification=gfile
|
||||
;; --with-file-notification=w32
|
||||
|
||||
;; A whole test run can be performed calling the command `file-notify-test-all'.
|
||||
|
||||
;;; Code:
|
||||
|
@ -64,6 +79,12 @@
|
|||
(format "/mock::%s" temporary-file-directory)))
|
||||
"Temporary directory for Tramp tests.")
|
||||
|
||||
;; Filter suppressed remote file-notify libraries.
|
||||
(when (stringp (getenv "REMOTE_FILE_NOTIFY_LIBRARY"))
|
||||
(dolist (lib '("inotifywait" "gio-monitor" "gvfs-monitor-dir"))
|
||||
(unless (string-equal (getenv "REMOTE_FILE_NOTIFY_LIBRARY") lib)
|
||||
(add-to-list 'tramp-connection-properties `(nil ,lib nil)))))
|
||||
|
||||
(defvar file-notify--test-tmpdir nil)
|
||||
(defvar file-notify--test-tmpfile nil)
|
||||
(defvar file-notify--test-tmpfile1 nil)
|
||||
|
@ -250,7 +271,8 @@ This returns only for the local case and gfilenotify; otherwise it is nil.
|
|||
(skip-unless (not ,skip))
|
||||
(let* ((temporary-file-directory
|
||||
file-notify-test-remote-temporary-file-directory)
|
||||
(ert-test (ert-get-test ',test)))
|
||||
(ert-test (ert-get-test ',test))
|
||||
vc-handled-backends)
|
||||
(skip-unless (file-notify--test-remote-enabled))
|
||||
(tramp-cleanup-connection
|
||||
(tramp-dissect-file-name temporary-file-directory) nil 'keep-password)
|
||||
|
@ -1243,8 +1265,7 @@ delivered."
|
|||
(file-notify--test-cleanup)))
|
||||
|
||||
(file-notify--deftest-remote file-notify-test08-backup
|
||||
"Check that backup keeps file notification for remote files."
|
||||
(if (getenv "EMACS_HYDRA_CI") :failed :passed)) ; fixme bug#33735
|
||||
"Check that backup keeps file notification for remote files.")
|
||||
|
||||
(ert-deftest file-notify-test09-watched-file-in-watched-dir ()
|
||||
"Watches a directory and a file in that directory separately.
|
||||
|
|
Loading…
Add table
Reference in a new issue