diff options
| author | Michael Albinus | 2018-12-21 13:53:20 +0100 |
|---|---|---|
| committer | Michael Albinus | 2018-12-21 13:53:20 +0100 |
| commit | 452d0c52cdf9a1ac9fe0df8acff931e9ef94c0a2 (patch) | |
| tree | d2796b275f36e0212fa847ef269523ab5788a503 | |
| parent | f1faf85f003f6e526f3d7e27dbdd8bf7f151582b (diff) | |
| download | emacs-452d0c52cdf9a1ac9fe0df8acff931e9ef94c0a2.tar.gz emacs-452d0c52cdf9a1ac9fe0df8acff931e9ef94c0a2.zip | |
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).
| -rw-r--r-- | lisp/net/tramp-compat.el | 1 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 22 | ||||
| -rw-r--r-- | test/lisp/filenotify-tests.el | 27 |
3 files changed, 37 insertions, 13 deletions
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index e1bd18b0a90..eace3b38c26 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -264,6 +264,7 @@ If NAME is a remote file name, the local part of NAME is unquoted." | |||
| 264 | A nil value for either argument stands for the current time." | 264 | A nil value for either argument stands for the current time." |
| 265 | (equal (or t1 (current-time)) (or t2 (current-time))))) | 265 | (equal (or t1 (current-time)) (or t2 (current-time))))) |
| 266 | 266 | ||
| 267 | ;; `flatten-tree' has appeared in Emacs 27.1. | ||
| 267 | (if (fboundp 'flatten-tree) | 268 | (if (fboundp 'flatten-tree) |
| 268 | (defalias 'tramp-compat-flatten-tree 'flatten-tree) | 269 | (defalias 'tramp-compat-flatten-tree 'flatten-tree) |
| 269 | (defun tramp-compat-flatten-tree (tree) | 270 | (defun tramp-compat-flatten-tree (tree) |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 2959422a5da..ba652bddd35 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -3615,11 +3615,14 @@ Fall back to normal file name handler if no Tramp handler exists." | |||
| 3615 | (string-match-p "Monitoring not supported\\|No locations given" string) | 3615 | (string-match-p "Monitoring not supported\\|No locations given" string) |
| 3616 | (delete-process proc)) | 3616 | (delete-process proc)) |
| 3617 | 3617 | ||
| 3618 | ;; Delete empty lines. | ||
| 3619 | (setq string (replace-regexp-in-string "\n\n" "\n" string)) | ||
| 3620 | |||
| 3618 | (while (string-match | 3621 | (while (string-match |
| 3619 | (eval-when-compile | 3622 | (eval-when-compile |
| 3620 | (concat "^[^:]+:" | 3623 | (concat "^[^:]+:" |
| 3621 | "[[:space:]]\\([^:]+\\):" | 3624 | "[[:space:]]\\([^:]+\\):" |
| 3622 | "[[:space:]]" (regexp-opt tramp-gio-events t) | 3625 | "[[:space:]]" (regexp-opt tramp-gio-events t) |
| 3623 | "\\([[:space:]]\\([^:]+\\)\\)?$")) | 3626 | "\\([[:space:]]\\([^:]+\\)\\)?$")) |
| 3624 | string) | 3627 | string) |
| 3625 | 3628 | ||
| @@ -3713,7 +3716,7 @@ file-notify events." | |||
| 3713 | (tramp-message proc 6 "%S\n%s" proc string) | 3716 | (tramp-message proc 6 "%S\n%s" proc string) |
| 3714 | (dolist (line (split-string string "[\n\r]+" 'omit)) | 3717 | (dolist (line (split-string string "[\n\r]+" 'omit)) |
| 3715 | ;; Check, whether there is a problem. | 3718 | ;; Check, whether there is a problem. |
| 3716 | (unless (string-match-p | 3719 | (unless (string-match |
| 3717 | (eval-when-compile | 3720 | (eval-when-compile |
| 3718 | (concat "^[^[:blank:]]+" | 3721 | (concat "^[^[:blank:]]+" |
| 3719 | "[[:blank:]]+\\([^[:blank:]]+\\)+" | 3722 | "[[:blank:]]+\\([^[:blank:]]+\\)+" |
| @@ -3880,6 +3883,9 @@ This function expects to be in the right *tramp* buffer." | |||
| 3880 | (setq result (buffer-substring (point) (point-at-eol))))) | 3883 | (setq result (buffer-substring (point) (point-at-eol))))) |
| 3881 | result))) | 3884 | result))) |
| 3882 | 3885 | ||
| 3886 | ;; On hydra.nixos.org, the $PATH environment variable is too long to | ||
| 3887 | ;; send it. This is likely not due to PATH_MAX, but PIPE_BUF. We | ||
| 3888 | ;; check it, and use a temporary file in case of. See Bug#33781. | ||
| 3883 | (defun tramp-set-remote-path (vec) | 3889 | (defun tramp-set-remote-path (vec) |
| 3884 | "Sets the remote environment PATH to existing directories. | 3890 | "Sets the remote environment PATH to existing directories. |
| 3885 | I.e., for each directory in `tramp-remote-path', it is tested | 3891 | I.e., for each directory in `tramp-remote-path', it is tested |
| @@ -3888,12 +3894,12 @@ variable PATH." | |||
| 3888 | (let ((command | 3894 | (let ((command |
| 3889 | (format "PATH=%s; export PATH" | 3895 | (format "PATH=%s; export PATH" |
| 3890 | (mapconcat 'identity (tramp-get-remote-path vec) ":"))) | 3896 | (mapconcat 'identity (tramp-get-remote-path vec) ":"))) |
| 3891 | (path-max | 3897 | (pipe-buf |
| 3892 | (with-tramp-connection-property vec "path-max" | 3898 | (with-tramp-connection-property vec "pipe-buf" |
| 3893 | (tramp-send-command-and-read vec "getconf PATH_MAX /"))) | 3899 | (tramp-send-command-and-read vec "getconf PIPE_BUF /"))) |
| 3894 | tmpfile) | 3900 | tmpfile) |
| 3895 | (tramp-message vec 5 "Setting $PATH environment variable") | 3901 | (tramp-message vec 5 "Setting $PATH environment variable") |
| 3896 | (if (< (length command) path-max) | 3902 | (if (< (length command) pipe-buf) |
| 3897 | (tramp-send-command vec command) | 3903 | (tramp-send-command vec command) |
| 3898 | ;; Use a temporary file. | 3904 | ;; Use a temporary file. |
| 3899 | (setq tmpfile (tramp-make-tramp-temp-file vec)) | 3905 | (setq tmpfile (tramp-make-tramp-temp-file vec)) |
| @@ -5785,10 +5791,6 @@ function cell is returned to be applied on a buffer." | |||
| 5785 | ;; gets confused about the file locking status. Try to find out why | 5791 | ;; gets confused about the file locking status. Try to find out why |
| 5786 | ;; the workaround doesn't work. | 5792 | ;; the workaround doesn't work. |
| 5787 | ;; | 5793 | ;; |
| 5788 | ;; * Allow out-of-band methods as _last_ multi-hop. Open a connection | ||
| 5789 | ;; until the last but one hop via `start-file-process'. Apply it | ||
| 5790 | ;; also for ftp and smb. | ||
| 5791 | ;; | ||
| 5792 | ;; * WIBNI if we had a command "trampclient"? If I was editing in | 5794 | ;; * WIBNI if we had a command "trampclient"? If I was editing in |
| 5793 | ;; some shell with root privileges, it would be nice if I could | 5795 | ;; some shell with root privileges, it would be nice if I could |
| 5794 | ;; just call | 5796 | ;; just call |
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 51b323f9b47..fb268b45138 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el | |||
| @@ -31,6 +31,21 @@ | |||
| 31 | ;; remote host, set this environment variable to "/dev/null" or | 31 | ;; remote host, set this environment variable to "/dev/null" or |
| 32 | ;; whatever is appropriate on your system. | 32 | ;; whatever is appropriate on your system. |
| 33 | 33 | ||
| 34 | ;; For the remote file-notify library, Tramp checks for the existence | ||
| 35 | ;; of a respective command. The first command found is used. In | ||
| 36 | ;; order to use a dedicated one, the environment variable | ||
| 37 | ;; $REMOTE_FILE_NOTIFY_LIBRARY shall be set, possible values are | ||
| 38 | ;; "inotifywait", "gio-monitor" and "gvfs-monitor-dir". | ||
| 39 | |||
| 40 | ;; Local file-notify libraries are auto-detected during Emacs | ||
| 41 | ;; configuration. This can be changed with a respective configuration | ||
| 42 | ;; argument, like | ||
| 43 | ;; | ||
| 44 | ;; --with-file-notification=inotify | ||
| 45 | ;; --with-file-notification=kqueue | ||
| 46 | ;; --with-file-notification=gfile | ||
| 47 | ;; --with-file-notification=w32 | ||
| 48 | |||
| 34 | ;; A whole test run can be performed calling the command `file-notify-test-all'. | 49 | ;; A whole test run can be performed calling the command `file-notify-test-all'. |
| 35 | 50 | ||
| 36 | ;;; Code: | 51 | ;;; Code: |
| @@ -64,6 +79,12 @@ | |||
| 64 | (format "/mock::%s" temporary-file-directory))) | 79 | (format "/mock::%s" temporary-file-directory))) |
| 65 | "Temporary directory for Tramp tests.") | 80 | "Temporary directory for Tramp tests.") |
| 66 | 81 | ||
| 82 | ;; Filter suppressed remote file-notify libraries. | ||
| 83 | (when (stringp (getenv "REMOTE_FILE_NOTIFY_LIBRARY")) | ||
| 84 | (dolist (lib '("inotifywait" "gio-monitor" "gvfs-monitor-dir")) | ||
| 85 | (unless (string-equal (getenv "REMOTE_FILE_NOTIFY_LIBRARY") lib) | ||
| 86 | (add-to-list 'tramp-connection-properties `(nil ,lib nil))))) | ||
| 87 | |||
| 67 | (defvar file-notify--test-tmpdir nil) | 88 | (defvar file-notify--test-tmpdir nil) |
| 68 | (defvar file-notify--test-tmpfile nil) | 89 | (defvar file-notify--test-tmpfile nil) |
| 69 | (defvar file-notify--test-tmpfile1 nil) | 90 | (defvar file-notify--test-tmpfile1 nil) |
| @@ -250,7 +271,8 @@ This returns only for the local case and gfilenotify; otherwise it is nil. | |||
| 250 | (skip-unless (not ,skip)) | 271 | (skip-unless (not ,skip)) |
| 251 | (let* ((temporary-file-directory | 272 | (let* ((temporary-file-directory |
| 252 | file-notify-test-remote-temporary-file-directory) | 273 | file-notify-test-remote-temporary-file-directory) |
| 253 | (ert-test (ert-get-test ',test))) | 274 | (ert-test (ert-get-test ',test)) |
| 275 | vc-handled-backends) | ||
| 254 | (skip-unless (file-notify--test-remote-enabled)) | 276 | (skip-unless (file-notify--test-remote-enabled)) |
| 255 | (tramp-cleanup-connection | 277 | (tramp-cleanup-connection |
| 256 | (tramp-dissect-file-name temporary-file-directory) nil 'keep-password) | 278 | (tramp-dissect-file-name temporary-file-directory) nil 'keep-password) |
| @@ -1243,8 +1265,7 @@ delivered." | |||
| 1243 | (file-notify--test-cleanup))) | 1265 | (file-notify--test-cleanup))) |
| 1244 | 1266 | ||
| 1245 | (file-notify--deftest-remote file-notify-test08-backup | 1267 | (file-notify--deftest-remote file-notify-test08-backup |
| 1246 | "Check that backup keeps file notification for remote files." | 1268 | "Check that backup keeps file notification for remote files.") |
| 1247 | (if (getenv "EMACS_HYDRA_CI") :failed :passed)) ; fixme bug#33735 | ||
| 1248 | 1269 | ||
| 1249 | (ert-deftest file-notify-test09-watched-file-in-watched-dir () | 1270 | (ert-deftest file-notify-test09-watched-file-in-watched-dir () |
| 1250 | "Watches a directory and a file in that directory separately. | 1271 | "Watches a directory and a file in that directory separately. |