diff options
| author | Michael Albinus | 2020-06-21 15:19:51 +0200 |
|---|---|---|
| committer | Michael Albinus | 2020-06-21 15:19:51 +0200 |
| commit | f18b035763785ffa9d8e27f3ec2be183b741502e (patch) | |
| tree | 8b07b6c4158d2ef319145952bd134d5ed1b65b16 | |
| parent | 1ecd350f38ee782cdebf4b08a59f2c1974ad44bd (diff) | |
| download | emacs-f18b035763785ffa9d8e27f3ec2be183b741502e.tar.gz emacs-f18b035763785ffa9d8e27f3ec2be183b741502e.zip | |
Fix remaining problems with tramp-crypt.el
* lisp/net/tramp-compat.el (tramp-compat-make-temp-file):
Simplify implementation.
* lisp/net/tramp-crypt.el (tramp-crypt-handle-delete-file)
(tramp-crypt-handle-file-attributes, tramp-crypt-handle-file-system-info)
(tramp-crypt-handle-make-directory): Let-bind `tramp-crypt-enabled' to nil.
* lisp/net/tramp.el (tramp-file-name-for-operation): Fix for operations
with two arguments.
(tramp-handle-load): Suppress `signal-hook-function' when NOERROR
is non-nil.
* test/lisp/net/tramp-tests.el (tramp-test41-utf8)
(tramp-test41-utf8-with-stat, tramp-test41-utf8-with-perl)
(tramp-test41-utf8-with-ls): Skip if needed.
| -rw-r--r-- | lisp/net/tramp-compat.el | 10 | ||||
| -rw-r--r-- | lisp/net/tramp-crypt.el | 20 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 4 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 5 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 4 |
5 files changed, 22 insertions, 21 deletions
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 48670edcaa0..218594b551c 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -71,12 +71,10 @@ It is the default value of `temporary-file-directory'." | |||
| 71 | (defsubst tramp-compat-make-temp-file (f &optional dir-flag) | 71 | (defsubst tramp-compat-make-temp-file (f &optional dir-flag) |
| 72 | "Create a local temporary file (compat function). | 72 | "Create a local temporary file (compat function). |
| 73 | Add the extension of F, if existing." | 73 | Add the extension of F, if existing." |
| 74 | (let* (file-name-handler-alist | 74 | (make-temp-file |
| 75 | (prefix (expand-file-name | 75 | (expand-file-name |
| 76 | (symbol-value 'tramp-temp-name-prefix) | 76 | tramp-temp-name-prefix (tramp-compat-temporary-file-directory)) |
| 77 | (tramp-compat-temporary-file-directory))) | 77 | dir-flag (file-name-extension f t))) |
| 78 | (extension (file-name-extension f t))) | ||
| 79 | (make-temp-file prefix dir-flag extension))) | ||
| 80 | 78 | ||
| 81 | ;; `temporary-file-directory' as function is introduced with Emacs 26.1. | 79 | ;; `temporary-file-directory' as function is introduced with Emacs 26.1. |
| 82 | (defalias 'tramp-compat-temporary-file-directory-function | 80 | (defalias 'tramp-compat-temporary-file-directory-function |
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el index c859af83cd6..c9788fcff52 100644 --- a/lisp/net/tramp-crypt.el +++ b/lisp/net/tramp-crypt.el | |||
| @@ -664,8 +664,8 @@ absolute file names." | |||
| 664 | "Like `delete-file' for Tramp files." | 664 | "Like `delete-file' for Tramp files." |
| 665 | (with-parsed-tramp-file-name (expand-file-name filename) nil | 665 | (with-parsed-tramp-file-name (expand-file-name filename) nil |
| 666 | (tramp-flush-file-properties v localname) | 666 | (tramp-flush-file-properties v localname) |
| 667 | (tramp-crypt-run-real-handler | 667 | (let (tramp-crypt-enabled) |
| 668 | #'delete-file (list (tramp-crypt-encrypt-file-name filename) trash)))) | 668 | (delete-file (tramp-crypt-encrypt-file-name filename) trash)))) |
| 669 | 669 | ||
| 670 | (defun tramp-crypt-handle-directory-files (directory &optional full match nosort) | 670 | (defun tramp-crypt-handle-directory-files (directory &optional full match nosort) |
| 671 | "Like `directory-files' for Tramp files." | 671 | "Like `directory-files' for Tramp files." |
| @@ -700,8 +700,8 @@ absolute file names." | |||
| 700 | 700 | ||
| 701 | (defun tramp-crypt-handle-file-attributes (filename &optional id-format) | 701 | (defun tramp-crypt-handle-file-attributes (filename &optional id-format) |
| 702 | "Like `file-attributes' for Tramp files." | 702 | "Like `file-attributes' for Tramp files." |
| 703 | (tramp-crypt-run-real-handler | 703 | (let (tramp-crypt-enabled) |
| 704 | #'file-attributes (list (tramp-crypt-encrypt-file-name filename) id-format))) | 704 | (file-attributes (tramp-crypt-encrypt-file-name filename) id-format))) |
| 705 | 705 | ||
| 706 | (defun tramp-crypt-handle-file-executable-p (filename) | 706 | (defun tramp-crypt-handle-file-executable-p (filename) |
| 707 | "Like `file-executable-p' for Tramp files." | 707 | "Like `file-executable-p' for Tramp files." |
| @@ -735,10 +735,10 @@ absolute file names." | |||
| 735 | 735 | ||
| 736 | (defun tramp-crypt-handle-file-system-info (filename) | 736 | (defun tramp-crypt-handle-file-system-info (filename) |
| 737 | "Like `file-system-info' for Tramp files." | 737 | "Like `file-system-info' for Tramp files." |
| 738 | (tramp-crypt-run-real-handler | 738 | (let (tramp-crypt-enabled) |
| 739 | ;; `file-system-info' exists since Emacs 27.1. Then, we can use | 739 | ;; `file-system-info' exists since Emacs 27.1. |
| 740 | ;; #'file-system-info. | 740 | (tramp-compat-funcall |
| 741 | 'file-system-info (list (tramp-crypt-encrypt-file-name filename)))) | 741 | 'file-system-info (tramp-crypt-encrypt-file-name filename)))) |
| 742 | 742 | ||
| 743 | (defun tramp-crypt-handle-file-writable-p (filename) | 743 | (defun tramp-crypt-handle-file-writable-p (filename) |
| 744 | "Like `file-writable-p' for Tramp files." | 744 | "Like `file-writable-p' for Tramp files." |
| @@ -776,8 +776,8 @@ WILDCARD is not supported." | |||
| 776 | (with-parsed-tramp-file-name (expand-file-name dir) nil | 776 | (with-parsed-tramp-file-name (expand-file-name dir) nil |
| 777 | (when (and (null parents) (file-exists-p dir)) | 777 | (when (and (null parents) (file-exists-p dir)) |
| 778 | (tramp-error v 'file-already-exists "Directory already exists %s" dir)) | 778 | (tramp-error v 'file-already-exists "Directory already exists %s" dir)) |
| 779 | (tramp-crypt-run-real-handler | 779 | (let (tramp-crypt-enabled) |
| 780 | #'make-directory (list (tramp-crypt-encrypt-file-name dir) parents)) | 780 | (make-directory (tramp-crypt-encrypt-file-name dir) parents)) |
| 781 | ;; When PARENTS is non-nil, DIR could be a chain of non-existent | 781 | ;; When PARENTS is non-nil, DIR could be a chain of non-existent |
| 782 | ;; directories a/b/c/... Instead of checking, we simply flush the | 782 | ;; directories a/b/c/... Instead of checking, we simply flush the |
| 783 | ;; whole cache. | 783 | ;; whole cache. |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 539d0486d27..89e5dc9e658 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -1331,9 +1331,7 @@ component is used as the target of the symlink." | |||
| 1331 | (format | 1331 | (format |
| 1332 | (eval-when-compile | 1332 | (eval-when-compile |
| 1333 | (concat | 1333 | (concat |
| 1334 | ;; On Opsware, pdksh (which is the true name of ksh there) | 1334 | ;; Apostrophes in the stat output are masked as |
| 1335 | ;; doesn't parse correctly the sequence "((". Therefore, we | ||
| 1336 | ;; add a space. Apostrophes in the stat output are masked as | ||
| 1337 | ;; `tramp-stat-marker', in order to make a proper shell escape | 1335 | ;; `tramp-stat-marker', in order to make a proper shell escape |
| 1338 | ;; of them in file names. | 1336 | ;; of them in file names. |
| 1339 | "(%s -c '((%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' %s |" | 1337 | "(%s -c '((%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' %s |" |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 1b50a6cf25b..1566162feaf 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -2259,7 +2259,7 @@ Must be handled by the callers." | |||
| 2259 | file-newer-than-file-p rename-file)) | 2259 | file-newer-than-file-p rename-file)) |
| 2260 | (cond | 2260 | (cond |
| 2261 | ((tramp-tramp-file-p (nth 0 args)) (nth 0 args)) | 2261 | ((tramp-tramp-file-p (nth 0 args)) (nth 0 args)) |
| 2262 | ((tramp-tramp-file-p (nth 1 args)) (nth 1 args)) | 2262 | ((file-name-absolute-p (nth 1 args)) (nth 1 args)) |
| 2263 | (t default-directory))) | 2263 | (t default-directory))) |
| 2264 | ;; FILE DIRECTORY resp FILE1 FILE2. | 2264 | ;; FILE DIRECTORY resp FILE1 FILE2. |
| 2265 | ((eq operation 'expand-file-name) | 2265 | ((eq operation 'expand-file-name) |
| @@ -3630,7 +3630,8 @@ User is always nil." | |||
| 3630 | v tramp-file-missing "Cannot load nonexistent file `%s'" file)) | 3630 | v tramp-file-missing "Cannot load nonexistent file `%s'" file)) |
| 3631 | (if (not (file-exists-p file)) | 3631 | (if (not (file-exists-p file)) |
| 3632 | nil | 3632 | nil |
| 3633 | (let ((inhibit-message nomessage)) | 3633 | (let ((signal-hook-function (unless noerror signal-hook-function)) |
| 3634 | (inhibit-message (or inhibit-message nomessage))) | ||
| 3634 | (with-tramp-progress-reporter v 0 (format "Loading %s" file) | 3635 | (with-tramp-progress-reporter v 0 (format "Loading %s" file) |
| 3635 | (let ((local-copy (file-local-copy file))) | 3636 | (let ((local-copy (file-local-copy file))) |
| 3636 | (unwind-protect | 3637 | (unwind-protect |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index cb30a360225..43630c4debd 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -6042,6 +6042,7 @@ Use the `ls' command." | |||
| 6042 | (skip-unless (not (tramp--test-windows-nt-and-batch))) | 6042 | (skip-unless (not (tramp--test-windows-nt-and-batch))) |
| 6043 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) | 6043 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) |
| 6044 | (skip-unless (not (tramp--test-ksh-p))) | 6044 | (skip-unless (not (tramp--test-ksh-p))) |
| 6045 | (skip-unless (not (tramp--test-crypt-p))) | ||
| 6045 | 6046 | ||
| 6046 | (tramp--test-utf8)) | 6047 | (tramp--test-utf8)) |
| 6047 | 6048 | ||
| @@ -6056,6 +6057,7 @@ Use the `stat' command." | |||
| 6056 | (skip-unless (not (tramp--test-windows-nt-and-batch))) | 6057 | (skip-unless (not (tramp--test-windows-nt-and-batch))) |
| 6057 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) | 6058 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) |
| 6058 | (skip-unless (not (tramp--test-ksh-p))) | 6059 | (skip-unless (not (tramp--test-ksh-p))) |
| 6060 | (skip-unless (not (tramp--test-crypt-p))) | ||
| 6059 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil | 6061 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil |
| 6060 | (skip-unless (tramp-get-remote-stat v))) | 6062 | (skip-unless (tramp-get-remote-stat v))) |
| 6061 | 6063 | ||
| @@ -6077,6 +6079,7 @@ Use the `perl' command." | |||
| 6077 | (skip-unless (not (tramp--test-windows-nt-and-batch))) | 6079 | (skip-unless (not (tramp--test-windows-nt-and-batch))) |
| 6078 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) | 6080 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) |
| 6079 | (skip-unless (not (tramp--test-ksh-p))) | 6081 | (skip-unless (not (tramp--test-ksh-p))) |
| 6082 | (skip-unless (not (tramp--test-crypt-p))) | ||
| 6080 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil | 6083 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil |
| 6081 | (skip-unless (tramp-get-remote-perl v))) | 6084 | (skip-unless (tramp-get-remote-perl v))) |
| 6082 | 6085 | ||
| @@ -6101,6 +6104,7 @@ Use the `ls' command." | |||
| 6101 | (skip-unless (not (tramp--test-windows-nt-and-batch))) | 6104 | (skip-unless (not (tramp--test-windows-nt-and-batch))) |
| 6102 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) | 6105 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) |
| 6103 | (skip-unless (not (tramp--test-ksh-p))) | 6106 | (skip-unless (not (tramp--test-ksh-p))) |
| 6107 | (skip-unless (not (tramp--test-crypt-p))) | ||
| 6104 | 6108 | ||
| 6105 | (let ((tramp-connection-properties | 6109 | (let ((tramp-connection-properties |
| 6106 | (append | 6110 | (append |