1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

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.
This commit is contained in:
Michael Albinus 2020-06-21 15:19:51 +02:00
parent 1ecd350f38
commit f18b035763
5 changed files with 22 additions and 21 deletions

View file

@ -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

View file

@ -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.

View file

@ -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 |"

View file

@ -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

View file

@ -6042,6 +6042,7 @@ Use the `ls' command."
(skip-unless (not (tramp--test-windows-nt-and-batch)))
(skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p)))
(skip-unless (not (tramp--test-ksh-p)))
(skip-unless (not (tramp--test-crypt-p)))
(tramp--test-utf8))
@ -6056,6 +6057,7 @@ Use the `stat' command."
(skip-unless (not (tramp--test-windows-nt-and-batch)))
(skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p)))
(skip-unless (not (tramp--test-ksh-p)))
(skip-unless (not (tramp--test-crypt-p)))
(with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
(skip-unless (tramp-get-remote-stat v)))
@ -6077,6 +6079,7 @@ Use the `perl' command."
(skip-unless (not (tramp--test-windows-nt-and-batch)))
(skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p)))
(skip-unless (not (tramp--test-ksh-p)))
(skip-unless (not (tramp--test-crypt-p)))
(with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
(skip-unless (tramp-get-remote-perl v)))
@ -6101,6 +6104,7 @@ Use the `ls' command."
(skip-unless (not (tramp--test-windows-nt-and-batch)))
(skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p)))
(skip-unless (not (tramp--test-ksh-p)))
(skip-unless (not (tramp--test-crypt-p)))
(let ((tramp-connection-properties
(append