diff options
| author | Michael Albinus | 2017-11-27 13:31:53 +0100 |
|---|---|---|
| committer | Michael Albinus | 2017-11-27 13:31:53 +0100 |
| commit | 06d05fec84ded5d48aafc8649f861884afdec0b7 (patch) | |
| tree | 122f80dbbfb9ddf854071112ca1333bb022eb3d3 | |
| parent | ac64fdb248d791b204cf579f878f8542ded0d067 (diff) | |
| download | emacs-06d05fec84ded5d48aafc8649f861884afdec0b7.tar.gz emacs-06d05fec84ded5d48aafc8649f861884afdec0b7.zip | |
Fix Bug#29163
* lisp/net/tramp.el (tramp-autoload-file-name-regexp):
Do not use "\\'" in regexp. (Bug#29163)
(top) Do not run (tramp-register-autoload-file-name-handlers)
when loading tramp.el.
* test/lisp/net/tramp-tests.el (tramp--test-mock-p): New defun.
(tramp-test32-environment-variables-and-port-numbers)
(tramp-test41-asynchronous-requests): Use it.
(tramp-test42-auto-load): New test.
(tramp-test43-recursive-load, tramp-test44-remote-load-path)
(tramp-test45-delay-load, tramp-test46-unload): Rename.
| -rw-r--r-- | lisp/net/tramp.el | 5 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 44 |
2 files changed, 35 insertions, 14 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index efd31b26be6..13277ec6f34 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1055,7 +1055,7 @@ Also see `tramp-file-name-structure'.") | |||
| 1055 | "\\(-\\|[^/|:]\\{2,\\}\\)" | 1055 | "\\(-\\|[^/|:]\\{2,\\}\\)" |
| 1056 | ;; At least one character for method. | 1056 | ;; At least one character for method. |
| 1057 | "[^/|:]+") | 1057 | "[^/|:]+") |
| 1058 | ":\\'") | 1058 | ":") |
| 1059 | "Regular expression matching file names handled by Tramp autoload. | 1059 | "Regular expression matching file names handled by Tramp autoload. |
| 1060 | It must match the initial `tramp-syntax' settings. It should not | 1060 | It must match the initial `tramp-syntax' settings. It should not |
| 1061 | match file names at root of the underlying local file system, | 1061 | match file names at root of the underlying local file system, |
| @@ -2323,8 +2323,7 @@ Falls back to normal file name handler if no Tramp file name handler exists." | |||
| 2323 | 'tramp-autoload-file-name-handler)) | 2323 | 'tramp-autoload-file-name-handler)) |
| 2324 | (put 'tramp-autoload-file-name-handler 'safe-magic t))) | 2324 | (put 'tramp-autoload-file-name-handler 'safe-magic t))) |
| 2325 | 2325 | ||
| 2326 | ;;;###autoload | 2326 | ;;;###autoload (tramp-register-autoload-file-name-handlers) |
| 2327 | (tramp-register-autoload-file-name-handlers) | ||
| 2328 | 2327 | ||
| 2329 | (defun tramp-use-absolute-autoload-file-names () | 2328 | (defun tramp-use-absolute-autoload-file-names () |
| 2330 | "Change Tramp autoload objects to use absolute file names. | 2329 | "Change Tramp autoload objects to use absolute file names. |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 08c58c8027d..2141f52cb20 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -3627,11 +3627,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3627 | (skip-unless (tramp--test-enabled)) | 3627 | (skip-unless (tramp--test-enabled)) |
| 3628 | ;; We test it only for the mock-up connection; otherwise there might | 3628 | ;; We test it only for the mock-up connection; otherwise there might |
| 3629 | ;; be problems with the used ports. | 3629 | ;; be problems with the used ports. |
| 3630 | (skip-unless | 3630 | (skip-unless (and (eq tramp-syntax 'default) |
| 3631 | (and | 3631 | (tramp--test-mock-p))) |
| 3632 | (eq tramp-syntax 'default) | ||
| 3633 | (string-equal | ||
| 3634 | "mock" (file-remote-p tramp-test-temporary-file-directory 'method)))) | ||
| 3635 | 3632 | ||
| 3636 | ;; We force a reconnect, in order to have a clean environment. | 3633 | ;; We force a reconnect, in order to have a clean environment. |
| 3637 | (dolist (dir `(,tramp-test-temporary-file-directory | 3634 | (dolist (dir `(,tramp-test-temporary-file-directory |
| @@ -4041,6 +4038,12 @@ Several special characters do not work properly there." | |||
| 4041 | (file-truename tramp-test-temporary-file-directory) nil | 4038 | (file-truename tramp-test-temporary-file-directory) nil |
| 4042 | (string-match "^HP-UX" (tramp-get-connection-property v "uname" "")))) | 4039 | (string-match "^HP-UX" (tramp-get-connection-property v "uname" "")))) |
| 4043 | 4040 | ||
| 4041 | (defun tramp--test-mock-p () | ||
| 4042 | "Check, whether the mock method is used. | ||
| 4043 | This does not support external Emacs calls." | ||
| 4044 | (string-equal | ||
| 4045 | "mock" (file-remote-p tramp-test-temporary-file-directory 'method))) | ||
| 4046 | |||
| 4044 | (defun tramp--test-rsync-p () | 4047 | (defun tramp--test-rsync-p () |
| 4045 | "Check, whether the rsync method is used. | 4048 | "Check, whether the rsync method is used. |
| 4046 | This does not support special file names." | 4049 | This does not support special file names." |
| @@ -4495,8 +4498,7 @@ process sentinels. They shall not disturb each other." | |||
| 4495 | ;; We must distinguish due to performance reasons. | 4498 | ;; We must distinguish due to performance reasons. |
| 4496 | (timer-operation | 4499 | (timer-operation |
| 4497 | (cond | 4500 | (cond |
| 4498 | ((string-equal "mock" (file-remote-p tmp-name 'method)) | 4501 | ((tramp--test-mock-p) 'vc-registered) |
| 4499 | 'vc-registered) | ||
| 4500 | (t 'file-attributes))) | 4502 | (t 'file-attributes))) |
| 4501 | timer buffers kill-buffer-query-functions) | 4503 | timer buffers kill-buffer-query-functions) |
| 4502 | 4504 | ||
| @@ -4604,7 +4606,27 @@ process sentinels. They shall not disturb each other." | |||
| 4604 | (ignore-errors (cancel-timer timer)) | 4606 | (ignore-errors (cancel-timer timer)) |
| 4605 | (ignore-errors (delete-directory tmp-name 'recursive)))))) | 4607 | (ignore-errors (delete-directory tmp-name 'recursive)))))) |
| 4606 | 4608 | ||
| 4607 | (ert-deftest tramp-test42-recursive-load () | 4609 | (ert-deftest tramp-test42-auto-load () |
| 4610 | "Check that Tramp autoloads properly." | ||
| 4611 | (skip-unless (tramp--test-enabled)) | ||
| 4612 | (skip-unless (not (tramp--test-mock-p))) | ||
| 4613 | |||
| 4614 | (let ((default-directory (expand-file-name temporary-file-directory))) | ||
| 4615 | (let ((code | ||
| 4616 | (format | ||
| 4617 | "(message \"Tramp loaded: %%s\" (consp (file-attributes \"%s\")))" | ||
| 4618 | tramp-test-temporary-file-directory))) | ||
| 4619 | (should | ||
| 4620 | (string-match | ||
| 4621 | "Tramp loaded: t[\n\r]+" | ||
| 4622 | (shell-command-to-string | ||
| 4623 | (format | ||
| 4624 | "%s -batch -Q -L %s --eval %s" | ||
| 4625 | (expand-file-name invocation-name invocation-directory) | ||
| 4626 | (mapconcat 'shell-quote-argument load-path " -L ") | ||
| 4627 | (shell-quote-argument code)))))))) | ||
| 4628 | |||
| 4629 | (ert-deftest tramp-test43-recursive-load () | ||
| 4608 | "Check that Tramp does not fail due to recursive load." | 4630 | "Check that Tramp does not fail due to recursive load." |
| 4609 | (skip-unless (tramp--test-enabled)) | 4631 | (skip-unless (tramp--test-enabled)) |
| 4610 | 4632 | ||
| @@ -4627,7 +4649,7 @@ process sentinels. They shall not disturb each other." | |||
| 4627 | (mapconcat 'shell-quote-argument load-path " -L ") | 4649 | (mapconcat 'shell-quote-argument load-path " -L ") |
| 4628 | (shell-quote-argument code)))))))) | 4650 | (shell-quote-argument code)))))))) |
| 4629 | 4651 | ||
| 4630 | (ert-deftest tramp-test43-remote-load-path () | 4652 | (ert-deftest tramp-test44-remote-load-path () |
| 4631 | "Check that Tramp autoloads its packages with remote `load-path'." | 4653 | "Check that Tramp autoloads its packages with remote `load-path'." |
| 4632 | ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el. | 4654 | ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el. |
| 4633 | ;; It shall still work, when a remote file name is in the | 4655 | ;; It shall still work, when a remote file name is in the |
| @@ -4650,7 +4672,7 @@ process sentinels. They shall not disturb each other." | |||
| 4650 | (mapconcat 'shell-quote-argument load-path " -L ") | 4672 | (mapconcat 'shell-quote-argument load-path " -L ") |
| 4651 | (shell-quote-argument code))))))) | 4673 | (shell-quote-argument code))))))) |
| 4652 | 4674 | ||
| 4653 | (ert-deftest tramp-test44-delay-load () | 4675 | (ert-deftest tramp-test45-delay-load () |
| 4654 | "Check that Tramp is loaded lazily, only when needed." | 4676 | "Check that Tramp is loaded lazily, only when needed." |
| 4655 | ;; Tramp is neither loaded at Emacs startup, nor when completing a | 4677 | ;; Tramp is neither loaded at Emacs startup, nor when completing a |
| 4656 | ;; non-Tramp file name like "/foo". Completing a Tramp-alike file | 4678 | ;; non-Tramp file name like "/foo". Completing a Tramp-alike file |
| @@ -4677,7 +4699,7 @@ process sentinels. They shall not disturb each other." | |||
| 4677 | (mapconcat 'shell-quote-argument load-path " -L ") | 4699 | (mapconcat 'shell-quote-argument load-path " -L ") |
| 4678 | (shell-quote-argument (format code tm))))))))) | 4700 | (shell-quote-argument (format code tm))))))))) |
| 4679 | 4701 | ||
| 4680 | (ert-deftest tramp-test45-unload () | 4702 | (ert-deftest tramp-test46-unload () |
| 4681 | "Check that Tramp and its subpackages unload completely. | 4703 | "Check that Tramp and its subpackages unload completely. |
| 4682 | Since it unloads Tramp, it shall be the last test to run." | 4704 | Since it unloads Tramp, it shall be the last test to run." |
| 4683 | :tags '(:expensive-test) | 4705 | :tags '(:expensive-test) |