emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 3851765: * lisp/net/tramp-sh.el (tramp-get-remote-s


From: Michael Albinus
Subject: [Emacs-diffs] master 3851765: * lisp/net/tramp-sh.el (tramp-get-remote-stat): Ban "stat" on Solaris.
Date: Tue, 24 Sep 2019 11:57:02 -0400 (EDT)

branch: master
commit 38517651d0aa573b0af69d1c70e920b587930c4f
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    * lisp/net/tramp-sh.el (tramp-get-remote-stat): Ban "stat" on Solaris.
---
 lisp/net/tramp-sh.el | 43 ++++++++++++++++++++++++-------------------
 1 file changed, 24 insertions(+), 19 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index b708920..a53eea4 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -5528,25 +5528,30 @@ Nonexistent directories are removed from spec."
 (defun tramp-get-remote-stat (vec)
   "Determine remote `stat' command."
   (with-tramp-connection-property vec "stat"
-    (tramp-message vec 5 "Finding a suitable `stat' command")
-    (let ((result (tramp-find-executable
-                  vec "stat" (tramp-get-remote-path vec)))
-         tmp)
-      ;; Check whether stat(1) returns usable syntax.  "%s" does not
-      ;; work on older AIX systems.  Recent GNU stat versions (8.24?)
-      ;; use shell quoted format for "%N", we check the boundaries "`"
-      ;; and "'", therefore.  See Bug#23422 in coreutils.
-      ;; Since GNU stat 8.26, environment variable QUOTING_STYLE is
-      ;; supported.
-      (when result
-       (setq result (concat "env QUOTING_STYLE=locale " result)
-             tmp (tramp-send-command-and-read
-                  vec (format "%s -c '(\"%%N\" %%s)' /" result) 'noerror))
-       (unless (and (listp tmp) (stringp (car tmp))
-                    (string-match-p "^\\(`/'\\|‘/’\\)$" (car tmp))
-                    (integerp (cadr tmp)))
-         (setq result nil)))
-      result)))
+    ;; stat on Solaris is buggy.  We've got reports for "SunOS 5.10"
+    ;; and "SunOS 5.11" so far.
+    (unless (string-match-p
+            (eval-when-compile (regexp-opt '("SunOS 5.10" "SunOS 5.11")))
+            (tramp-get-connection-property vec "uname" ""))
+      (tramp-message vec 5 "Finding a suitable `stat' command")
+      (let ((result (tramp-find-executable
+                    vec "stat" (tramp-get-remote-path vec)))
+           tmp)
+       ;; Check whether stat(1) returns usable syntax.  "%s" does not
+       ;; work on older AIX systems.  Recent GNU stat versions
+       ;; (8.24?)  use shell quoted format for "%N", we check the
+       ;; boundaries "`" and "'", therefore.  See Bug#23422 in
+       ;; coreutils.  Since GNU stat 8.26, environment variable
+       ;; QUOTING_STYLE is supported.
+       (when result
+         (setq result (concat "env QUOTING_STYLE=locale " result)
+               tmp (tramp-send-command-and-read
+                    vec (format "%s -c '(\"%%N\" %%s)' /" result) 'noerror))
+         (unless (and (listp tmp) (stringp (car tmp))
+                      (string-match-p "^\\(`/'\\|‘/’\\)$" (car tmp))
+                      (integerp (cadr tmp)))
+           (setq result nil)))
+       result))))
 
 (defun tramp-get-remote-readlink (vec)
   "Determine remote `readlink' command."



reply via email to

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