From f18b035763785ffa9d8e27f3ec2be183b741502e Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 21 Jun 2020 15:19:51 +0200 Subject: 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. --- lisp/net/tramp-compat.el | 10 ++++------ lisp/net/tramp-crypt.el | 20 ++++++++++---------- lisp/net/tramp-sh.el | 4 +--- lisp/net/tramp.el | 5 +++-- 4 files changed, 18 insertions(+), 21 deletions(-) (limited to 'lisp/net') 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'." (defsubst tramp-compat-make-temp-file (f &optional dir-flag) "Create a local temporary file (compat function). Add the extension of F, if existing." - (let* (file-name-handler-alist - (prefix (expand-file-name - (symbol-value 'tramp-temp-name-prefix) - (tramp-compat-temporary-file-directory))) - (extension (file-name-extension f t))) - (make-temp-file prefix dir-flag extension))) + (make-temp-file + (expand-file-name + tramp-temp-name-prefix (tramp-compat-temporary-file-directory)) + dir-flag (file-name-extension f t))) ;; `temporary-file-directory' as function is introduced with Emacs 26.1. (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." "Like `delete-file' for Tramp files." (with-parsed-tramp-file-name (expand-file-name filename) nil (tramp-flush-file-properties v localname) - (tramp-crypt-run-real-handler - #'delete-file (list (tramp-crypt-encrypt-file-name filename) trash)))) + (let (tramp-crypt-enabled) + (delete-file (tramp-crypt-encrypt-file-name filename) trash)))) (defun tramp-crypt-handle-directory-files (directory &optional full match nosort) "Like `directory-files' for Tramp files." @@ -700,8 +700,8 @@ absolute file names." (defun tramp-crypt-handle-file-attributes (filename &optional id-format) "Like `file-attributes' for Tramp files." - (tramp-crypt-run-real-handler - #'file-attributes (list (tramp-crypt-encrypt-file-name filename) id-format))) + (let (tramp-crypt-enabled) + (file-attributes (tramp-crypt-encrypt-file-name filename) id-format))) (defun tramp-crypt-handle-file-executable-p (filename) "Like `file-executable-p' for Tramp files." @@ -735,10 +735,10 @@ absolute file names." (defun tramp-crypt-handle-file-system-info (filename) "Like `file-system-info' for Tramp files." - (tramp-crypt-run-real-handler - ;; `file-system-info' exists since Emacs 27.1. Then, we can use - ;; #'file-system-info. - 'file-system-info (list (tramp-crypt-encrypt-file-name filename)))) + (let (tramp-crypt-enabled) + ;; `file-system-info' exists since Emacs 27.1. + (tramp-compat-funcall + 'file-system-info (tramp-crypt-encrypt-file-name filename)))) (defun tramp-crypt-handle-file-writable-p (filename) "Like `file-writable-p' for Tramp files." @@ -776,8 +776,8 @@ WILDCARD is not supported." (with-parsed-tramp-file-name (expand-file-name dir) nil (when (and (null parents) (file-exists-p dir)) (tramp-error v 'file-already-exists "Directory already exists %s" dir)) - (tramp-crypt-run-real-handler - #'make-directory (list (tramp-crypt-encrypt-file-name dir) parents)) + (let (tramp-crypt-enabled) + (make-directory (tramp-crypt-encrypt-file-name dir) parents)) ;; When PARENTS is non-nil, DIR could be a chain of non-existent ;; directories a/b/c/... Instead of checking, we simply flush the ;; 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." (format (eval-when-compile (concat - ;; On Opsware, pdksh (which is the true name of ksh there) - ;; doesn't parse correctly the sequence "((". Therefore, we - ;; add a space. Apostrophes in the stat output are masked as + ;; Apostrophes in the stat output are masked as ;; `tramp-stat-marker', in order to make a proper shell escape ;; of them in file names. "(%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." file-newer-than-file-p rename-file)) (cond ((tramp-tramp-file-p (nth 0 args)) (nth 0 args)) - ((tramp-tramp-file-p (nth 1 args)) (nth 1 args)) + ((file-name-absolute-p (nth 1 args)) (nth 1 args)) (t default-directory))) ;; FILE DIRECTORY resp FILE1 FILE2. ((eq operation 'expand-file-name) @@ -3630,7 +3630,8 @@ User is always nil." v tramp-file-missing "Cannot load nonexistent file `%s'" file)) (if (not (file-exists-p file)) nil - (let ((inhibit-message nomessage)) + (let ((signal-hook-function (unless noerror signal-hook-function)) + (inhibit-message (or inhibit-message nomessage))) (with-tramp-progress-reporter v 0 (format "Loading %s" file) (let ((local-copy (file-local-copy file))) (unwind-protect -- cgit v1.2.3