Mitigate uutils coreutils problems in Tramp

* lisp/net/tramp-sh.el (tramp-get-ls-command): Prefer gnuls over ls.
(tramp-get-remote-readlink): Prefer gnureadlink over readlink.
(Bug#79956, Bug#80075)
This commit is contained in:
Michael Albinus 2026-01-03 15:46:22 +01:00
parent a9611b1022
commit 04112d04f2

View file

@ -5823,9 +5823,10 @@ Nonexistent directories are removed from spec."
(or
(catch 'ls-found
(dolist (cmd
;; Prefer GNU ls on *BSD and macOS.
;; Prefer GNU ls on *BSD and macOS. See also
;; Bug#80075 for Linux.
(if (tramp-check-remote-uname vec tramp-bsd-unames)
'("gls" "ls" "gnuls") '("ls" "gnuls" "gls")))
'("gls" "ls" "gnuls") '("gnuls" "ls" "gls")))
(let ((dl (tramp-get-remote-path vec))
result)
(while (and dl (setq result (tramp-find-executable vec cmd dl t t)))
@ -5966,11 +5967,14 @@ Nonexistent directories are removed from spec."
"Determine remote `readlink' command."
(with-tramp-connection-property vec "readlink"
(tramp-message vec 5 "Finding a suitable `readlink' command")
(when-let* ((result (tramp-find-executable
vec "readlink" (tramp-get-remote-path vec)))
((tramp-send-command-and-check
vec (format "%s --canonicalize-missing /" result))))
result)))
;; See Bug#80075.
(catch 'readlink-found
(dolist (cmd '("gnureadlink" "readlink"))
(when-let* ((result (tramp-find-executable
vec cmd (tramp-get-remote-path vec)))
((tramp-send-command-and-check
vec (format "%s --canonicalize-missing /" result))))
(throw 'readlink-found result))))))
(defun tramp-get-remote-touch (vec)
"Determine remote `touch' command."