]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix use of "dired" in Tramp
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 21 Apr 2024 10:54:17 +0000 (12:54 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 22 Apr 2024 18:36:07 +0000 (20:36 +0200)
* 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)

lisp/net/tramp-sh.el

index 046b83b0a499ba7be819205852e744dc18009b5b..5af1d723bb9aad4d24d70f46398ca3e930a969a7 100644 (file)
@@ -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))))