emacs-diffs
[Top][All Lists]
Advanced

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

master 3cefda0: Make Tramp's insert-directory more robust


From: Michael Albinus
Subject: master 3cefda0: Make Tramp's insert-directory more robust
Date: Sun, 24 Jan 2021 13:26:10 -0500 (EST)

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

    Make Tramp's insert-directory more robust
    
    * lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory):
    Use `tramp-sh--quoting-style-options'.
    
    * test/lisp/net/tramp-tests.el (tramp--test-hpux-p, tramp--test-ksh-p):
    Remove superfluous nil.
    (tramp--test-sh-no-ls--dired-p): New defun.
    (tramp--test-special-characters): Use it.
---
 lisp/net/tramp-sh.el         |  7 ++-----
 test/lisp/net/tramp-tests.el | 46 ++++++++++++++++++++++++++++----------------
 2 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index d7ca7c9..ed3d153 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2617,11 +2617,8 @@ The method used must be an out-of-band method."
         filename switches wildcard full-directory-p)
       (when (stringp switches)
         (setq switches (split-string switches)))
-      (when (tramp-get-ls-command-with ;FIXME: tramp-sh--quoting-style-options?
-            v "--quoting-style=literal --show-control-chars")
-       (setq switches
-             (append
-              switches '("--quoting-style=literal" "--show-control-chars"))))
+      (setq switches
+           (append switches (split-string (tramp-sh--quoting-style-options 
v))))
       (unless (tramp-get-ls-command-with v "--dired")
        (setq switches (delete "--dired" switches)))
       (when wildcard
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 4c84507..7757c55 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -5720,16 +5720,16 @@ This requires restrictions of file name syntax."
    (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
    'tramp-ftp-file-name-handler))
 
+(defun tramp--test-crypt-p ()
+  "Check, whether the remote directory is crypted"
+  (tramp-crypt-file-name-p tramp-test-temporary-file-directory))
+
 (defun tramp--test-docker-p ()
   "Check, whether the docker method is used.
 This does not support some special file names."
   (string-equal
    "docker" (file-remote-p tramp-test-temporary-file-directory 'method)))
 
-(defun tramp--test-crypt-p ()
-  "Check, whether the remote directory is crypted"
-  (tramp-crypt-file-name-p tramp-test-temporary-file-directory))
-
 (defun tramp--test-ftp-p ()
   "Check, whether an FTP-like method is used.
 This does not support globbing characters in file names (yet)."
@@ -5748,7 +5748,7 @@ If optional METHOD is given, it is checked first."
   "Check, whether the remote host runs HP-UX.
 Several special characters do not work properly there."
   ;; We must refill the cache.  `file-truename' does it.
-  (file-truename tramp-test-temporary-file-directory) nil
+  (file-truename tramp-test-temporary-file-directory)
   (string-match-p
    "^HP-UX" (tramp-get-connection-property tramp-test-vec "uname" "")))
 
@@ -5757,7 +5757,7 @@ Several special characters do not work properly there."
 ksh93 makes some strange conversions of non-latin characters into
 a $'' syntax."
   ;; We must refill the cache.  `file-truename' does it.
-  (file-truename tramp-test-temporary-file-directory) nil
+  (file-truename tramp-test-temporary-file-directory)
   (string-match-p
    "ksh$" (tramp-get-connection-property tramp-test-vec "remote-shell" "")))
 
@@ -5787,6 +5787,15 @@ This does not support special file names."
   "Check, whether the remote host runs a based method from tramp-sh.el."
   (tramp-sh-file-name-handler-p tramp-test-vec))
 
+(defun tramp--test-sh-no-ls--dired-p ()
+  "Check, whether the remote host runs a based method from tramp-sh.el.
+Additionally, ls does not support \"--dired\"."
+  (and (tramp--test-sh-p)
+       (with-temp-buffer
+        ;; We must refill the cache.  `insert-directory' does it.
+        (insert-directory tramp-test-temporary-file-directory "-al")
+        (not (tramp-get-connection-property tramp-test-vec "ls--dired" nil)))))
+
 (defun tramp--test-share-p ()
   "Check, whether the method needs a share."
   (and (tramp--test-gvfs-p)
@@ -6023,17 +6032,20 @@ This requires restrictions of file name syntax."
   ;; expanded to <TAB>.
   (let ((files
         (list
-         (if (or (tramp--test-ange-ftp-p)
-                 (tramp--test-gvfs-p)
-                 (tramp--test-rclone-p)
-                 (tramp--test-sudoedit-p)
-                 (tramp--test-windows-nt-or-smb-p))
-             "foo bar baz"
-           (if (or (tramp--test-adb-p)
-                   (tramp--test-docker-p)
-                   (eq system-type 'cygwin))
-               " foo bar baz "
-             " foo\tbar baz\t"))
+         (cond ((or (tramp--test-ange-ftp-p)
+                    (tramp--test-gvfs-p)
+                    (tramp--test-rclone-p)
+                    (tramp--test-sudoedit-p)
+                    (tramp--test-windows-nt-or-smb-p))
+                "foo bar baz")
+               ((or (tramp--test-adb-p)
+                    (tramp--test-docker-p)
+                    (eq system-type 'cygwin))
+                " foo bar baz ")
+               ((tramp--test-sh-no-ls--dired-p)
+                "\tfoo bar baz\t")
+               (t " foo\tbar baz\t"))
+         "@foo@bar@baz@"
          "$foo$bar$$baz$"
          "-foo-bar-baz-"
          "%foo%bar%baz%"



reply via email to

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