From: Michael Albinus Date: Sun, 21 Apr 2024 10:54:17 +0000 (+0200) Subject: Fix use of "dired" in Tramp X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=80c7ce91cc0a35542ba485cf8cb5bc6dabac0169;p=emacs.git Fix use of "dired" in Tramp * lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory): Do not use "--dired" when long format output isn't requested. (cherry picked from commit 9c01da56a547f493535e73877e16ccefcb2730a0) --- diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 046b83b0a49..5af1d723bb9 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2662,6 +2662,18 @@ The method used must be an out-of-band method." (let ((dired (tramp-get-ls-command-with v "--dired"))) (when (stringp switches) (setq switches (split-string switches))) + ;; Newer coreutil versions of ls (9.5 and up) imply long format + ;; output when "--dired" is given. Suppress this implicit rule. + (when dired + (let ((tem switches) + case-fold-search) + (catch 'long + (while tem + (when (and (not (string-match-p "--" (car tem))) + (string-match-p "l" (car tem))) + (throw 'long nil)) + (setq tem (cdr tem))) + (setq dired nil)))) (setq switches (append switches (split-string (tramp-sh--quoting-style-options v)) (when dired `(,dired))))