aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2021-01-24 19:26:02 +0100
committerMichael Albinus2021-01-24 19:26:02 +0100
commit3cefda090304bbbce43d242072918ca855326842 (patch)
tree0daa28160e517799d308cb2e32fa4ae8f6c033a2
parentb26e09e0f02b94d72bddfb108a16daffb74139f6 (diff)
downloademacs-3cefda090304bbbce43d242072918ca855326842.tar.gz
emacs-3cefda090304bbbce43d242072918ca855326842.zip
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.
-rw-r--r--lisp/net/tramp-sh.el7
-rw-r--r--test/lisp/net/tramp-tests.el46
2 files changed, 31 insertions, 22 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index d7ca7c9780c..ed3d15377c3 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."
2617 filename switches wildcard full-directory-p) 2617 filename switches wildcard full-directory-p)
2618 (when (stringp switches) 2618 (when (stringp switches)
2619 (setq switches (split-string switches))) 2619 (setq switches (split-string switches)))
2620 (when (tramp-get-ls-command-with ;FIXME: tramp-sh--quoting-style-options? 2620 (setq switches
2621 v "--quoting-style=literal --show-control-chars") 2621 (append switches (split-string (tramp-sh--quoting-style-options v))))
2622 (setq switches
2623 (append
2624 switches '("--quoting-style=literal" "--show-control-chars"))))
2625 (unless (tramp-get-ls-command-with v "--dired") 2622 (unless (tramp-get-ls-command-with v "--dired")
2626 (setq switches (delete "--dired" switches))) 2623 (setq switches (delete "--dired" switches)))
2627 (when wildcard 2624 (when wildcard
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 4c84507807b..7757c55c16b 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."
5720 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) 5720 (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
5721 'tramp-ftp-file-name-handler)) 5721 'tramp-ftp-file-name-handler))
5722 5722
5723(defun tramp--test-crypt-p ()
5724 "Check, whether the remote directory is crypted"
5725 (tramp-crypt-file-name-p tramp-test-temporary-file-directory))
5726
5723(defun tramp--test-docker-p () 5727(defun tramp--test-docker-p ()
5724 "Check, whether the docker method is used. 5728 "Check, whether the docker method is used.
5725This does not support some special file names." 5729This does not support some special file names."
5726 (string-equal 5730 (string-equal
5727 "docker" (file-remote-p tramp-test-temporary-file-directory 'method))) 5731 "docker" (file-remote-p tramp-test-temporary-file-directory 'method)))
5728 5732
5729(defun tramp--test-crypt-p ()
5730 "Check, whether the remote directory is crypted"
5731 (tramp-crypt-file-name-p tramp-test-temporary-file-directory))
5732
5733(defun tramp--test-ftp-p () 5733(defun tramp--test-ftp-p ()
5734 "Check, whether an FTP-like method is used. 5734 "Check, whether an FTP-like method is used.
5735This does not support globbing characters in file names (yet)." 5735This does not support globbing characters in file names (yet)."
@@ -5748,7 +5748,7 @@ If optional METHOD is given, it is checked first."
5748 "Check, whether the remote host runs HP-UX. 5748 "Check, whether the remote host runs HP-UX.
5749Several special characters do not work properly there." 5749Several special characters do not work properly there."
5750 ;; We must refill the cache. `file-truename' does it. 5750 ;; We must refill the cache. `file-truename' does it.
5751 (file-truename tramp-test-temporary-file-directory) nil 5751 (file-truename tramp-test-temporary-file-directory)
5752 (string-match-p 5752 (string-match-p
5753 "^HP-UX" (tramp-get-connection-property tramp-test-vec "uname" ""))) 5753 "^HP-UX" (tramp-get-connection-property tramp-test-vec "uname" "")))
5754 5754
@@ -5757,7 +5757,7 @@ Several special characters do not work properly there."
5757ksh93 makes some strange conversions of non-latin characters into 5757ksh93 makes some strange conversions of non-latin characters into
5758a $'' syntax." 5758a $'' syntax."
5759 ;; We must refill the cache. `file-truename' does it. 5759 ;; We must refill the cache. `file-truename' does it.
5760 (file-truename tramp-test-temporary-file-directory) nil 5760 (file-truename tramp-test-temporary-file-directory)
5761 (string-match-p 5761 (string-match-p
5762 "ksh$" (tramp-get-connection-property tramp-test-vec "remote-shell" ""))) 5762 "ksh$" (tramp-get-connection-property tramp-test-vec "remote-shell" "")))
5763 5763
@@ -5787,6 +5787,15 @@ This does not support special file names."
5787 "Check, whether the remote host runs a based method from tramp-sh.el." 5787 "Check, whether the remote host runs a based method from tramp-sh.el."
5788 (tramp-sh-file-name-handler-p tramp-test-vec)) 5788 (tramp-sh-file-name-handler-p tramp-test-vec))
5789 5789
5790(defun tramp--test-sh-no-ls--dired-p ()
5791 "Check, whether the remote host runs a based method from tramp-sh.el.
5792Additionally, ls does not support \"--dired\"."
5793 (and (tramp--test-sh-p)
5794 (with-temp-buffer
5795 ;; We must refill the cache. `insert-directory' does it.
5796 (insert-directory tramp-test-temporary-file-directory "-al")
5797 (not (tramp-get-connection-property tramp-test-vec "ls--dired" nil)))))
5798
5790(defun tramp--test-share-p () 5799(defun tramp--test-share-p ()
5791 "Check, whether the method needs a share." 5800 "Check, whether the method needs a share."
5792 (and (tramp--test-gvfs-p) 5801 (and (tramp--test-gvfs-p)
@@ -6023,17 +6032,20 @@ This requires restrictions of file name syntax."
6023 ;; expanded to <TAB>. 6032 ;; expanded to <TAB>.
6024 (let ((files 6033 (let ((files
6025 (list 6034 (list
6026 (if (or (tramp--test-ange-ftp-p) 6035 (cond ((or (tramp--test-ange-ftp-p)
6027 (tramp--test-gvfs-p) 6036 (tramp--test-gvfs-p)
6028 (tramp--test-rclone-p) 6037 (tramp--test-rclone-p)
6029 (tramp--test-sudoedit-p) 6038 (tramp--test-sudoedit-p)
6030 (tramp--test-windows-nt-or-smb-p)) 6039 (tramp--test-windows-nt-or-smb-p))
6031 "foo bar baz" 6040 "foo bar baz")
6032 (if (or (tramp--test-adb-p) 6041 ((or (tramp--test-adb-p)
6033 (tramp--test-docker-p) 6042 (tramp--test-docker-p)
6034 (eq system-type 'cygwin)) 6043 (eq system-type 'cygwin))
6035 " foo bar baz " 6044 " foo bar baz ")
6036 " foo\tbar baz\t")) 6045 ((tramp--test-sh-no-ls--dired-p)
6046 "\tfoo bar baz\t")
6047 (t " foo\tbar baz\t"))
6048 "@foo@bar@baz@"
6037 "$foo$bar$$baz$" 6049 "$foo$bar$$baz$"
6038 "-foo-bar-baz-" 6050 "-foo-bar-baz-"
6039 "%foo%bar%baz%" 6051 "%foo%bar%baz%"