emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f18b035: Fix remaining problems with tramp-crypt.el


From: Michael Albinus
Subject: master f18b035: Fix remaining problems with tramp-crypt.el
Date: Sun, 21 Jun 2020 09:19:59 -0400 (EDT)

branch: master
commit f18b035763785ffa9d8e27f3ec2be183b741502e
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    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 +++--
 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 48670ed..218594b 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 c859af8..c9788fc 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 539d048..89e5dc9 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 1b50a6c..1566162 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
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index cb30a36..43630c4 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]