Tramp: handle non-standard file system like GPFS
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 16 Jun 2024 14:03:41 +0000 (16:03 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 16 Jun 2024 14:03:41 +0000 (16:03 +0200)
* doc/misc/tramp.texi (Frequently Asked Questions):
Explain tramp-use-file-attributes.

* lisp/net/tramp.el (tramp-use-file-attributes): New defcustom and
defsubst.
(tramp-skeleton-file-exists-p):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-executable-p)
(tramp-adb-handle-file-readable-p):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-executable-p)
(tramp-sudoedit-handle-file-readable-p)
(tramp-sudoedit-handle-file-writable-p): Use it.
* lisp/net/tramp-sh.el (tramp-sh-handle-file-executable-p)
(tramp-sh-handle-file-readable-p)
(tramp-sh-handle-file-writable-p): Use it.
(tramp-sh-handle-set-file-acl): Fix property name.

doc/misc/tramp.texi
lisp/net/tramp-adb.el
lisp/net/tramp-sh.el
lisp/net/tramp-sudoedit.el
lisp/net/tramp.el

index ec8a8d5c3eb8bf8d299d5b5d14fbef8a0be1050d..dc119e8784970d4d6346022d41a50783fba1e492 100644 (file)
@@ -5546,6 +5546,18 @@ as follows:
 @end lisp
 
 
+@item
+@value{tramp} does not show directories or files although they are
+readable
+
+@vindex tramp-use-file-attributes
+Internally, @value{tramp} uses commands like @command{ls} or
+@command{stat} in order to determine file permissions.  On some file
+systems, like @acronym{GPFS}, they don't report proper information.
+Set the user option @code{tramp-use-file-attributes} to @code{nil} in
+such a case.
+
+
 @item
 Where are remote files trashed to?
 
index fb728dadd2d021ba01400d3ec497d032ac00a096..5b1c4ba5b19930f3663194ab6dccf6ebb4c1d7f0 100644 (file)
@@ -480,7 +480,7 @@ Emacs dired can't find files."
     (with-tramp-file-property v localname "file-executable-p"
       ;; Examine `file-attributes' cache to see if request can be
       ;; satisfied without remote operation.
-      (if (tramp-file-property-p v localname "file-attributes")
+      (if (tramp-use-file-attributes v)
          (or (tramp-check-cached-permissions v ?x)
              (tramp-check-cached-permissions v ?s))
        (tramp-adb-send-command-and-check
@@ -498,7 +498,7 @@ Emacs dired can't find files."
     (with-tramp-file-property v localname "file-readable-p"
       ;; Examine `file-attributes' cache to see if request can be
       ;; satisfied without remote operation.
-      (if (tramp-file-property-p v localname "file-attributes")
+      (if (tramp-use-file-attributes v)
          (tramp-handle-file-readable-p filename)
        (tramp-adb-send-command-and-check
         v (format "test -r %s" (tramp-shell-quote-argument localname)))))))
index a13ce01fd5021618e135fb229a0ceb056d260e9c..02be2ed4b7fb3ecb22bc4f091befe54eb3dfa7f5 100644 (file)
@@ -1770,7 +1770,7 @@ ID-FORMAT valid values are `string' and `integer'."
          (tramp-set-file-property v localname "file-acl" acl-string)
          t)
       ;; In case of errors, we return nil.
-      (tramp-flush-file-property v localname "file-acl-string")
+      (tramp-flush-file-property v localname "file-acl")
       nil)))
 
 ;; Simple functions using the `test' command.
@@ -1781,7 +1781,7 @@ ID-FORMAT valid values are `string' and `integer'."
     (with-tramp-file-property v localname "file-executable-p"
       ;; Examine `file-attributes' cache to see if request can be
       ;; satisfied without remote operation.
-      (if (tramp-file-property-p v localname "file-attributes")
+      (if (tramp-use-file-attributes v)
          (or (tramp-check-cached-permissions v ?x)
              (tramp-check-cached-permissions v ?s))
        (tramp-run-test v "-x" localname)))))
@@ -1792,7 +1792,7 @@ ID-FORMAT valid values are `string' and `integer'."
     (with-tramp-file-property v localname "file-readable-p"
       ;; Examine `file-attributes' cache to see if request can be
       ;; satisfied without remote operation.
-      (if (tramp-file-property-p v localname "file-attributes")
+      (if (tramp-use-file-attributes v)
          (tramp-handle-file-readable-p filename)
        (tramp-run-test v "-r" localname)))))
 
@@ -1824,7 +1824,7 @@ ID-FORMAT valid values are `string' and `integer'."
       (if (file-exists-p filename)
          ;; Examine `file-attributes' cache to see if request can be
          ;; satisfied without remote operation.
-         (if (tramp-file-property-p v localname "file-attributes")
+         (if (tramp-use-file-attributes v)
              (tramp-check-cached-permissions v ?w)
            (tramp-run-test v "-w" localname))
        ;; If file doesn't exist, check if directory is writable.
index 7bbfec627536fe7d97b780b7de60badf3a989680..c82cd2dc0e134033c178514d1ab3c6a891f1de8d 100644 (file)
@@ -475,7 +475,7 @@ the result will be a local, non-Tramp, file name."
     (with-tramp-file-property v localname "file-executable-p"
       ;; Examine `file-attributes' cache to see if request can be
       ;; satisfied without remote operation.
-      (if (tramp-file-property-p v localname "file-attributes")
+      (if (tramp-use-file-attributes v)
          (or (tramp-check-cached-permissions v ?x)
              (tramp-check-cached-permissions v ?s))
        (tramp-sudoedit-send-command
@@ -515,7 +515,7 @@ the result will be a local, non-Tramp, file name."
     (with-tramp-file-property v localname "file-readable-p"
       ;; Examine `file-attributes' cache to see if request can be
       ;; satisfied without remote operation.
-      (if (tramp-file-property-p v localname "file-attributes")
+      (if (tramp-use-file-attributes v)
          (tramp-handle-file-readable-p filename)
        (tramp-sudoedit-send-command
         v "test" "-r" (file-name-unquote localname))))))
@@ -600,7 +600,7 @@ the result will be a local, non-Tramp, file name."
       (if (file-exists-p filename)
          ;; Examine `file-attributes' cache to see if request can be
          ;; satisfied without remote operation.
-         (if (tramp-file-property-p v localname "file-attributes")
+         (if (tramp-use-file-attributes v)
              (tramp-check-cached-permissions v ?w)
            (tramp-sudoedit-send-command
             v "test" "-w" (file-name-unquote localname)))
index 4dd0d1d63a453e2007f586455007e4c32d130fbb..ee7fa59ad21467830441b8d1d22b3c976fcf6818 100644 (file)
@@ -3444,6 +3444,20 @@ BODY is the backend specific code."
         (tramp-dissect-file-name ,directory) 'file-missing ,directory)
       nil)))
 
+(defcustom tramp-use-file-attributes t
+  "Whether to use \"file-attributes\" file property for check.
+This is relevant for `file-directory-p', `file-executable-p',
+`file-exists-p', and `file-readable-p'.  On some file systems, like
+GPFS, the permission string is not trustworthy."
+  :version "30.1"
+  :type 'boolean)
+
+(defsubst tramp-use-file-attributes (vec)
+  "Whether to use \"file-attributes\" file property for check."
+  (and tramp-use-file-attributes
+       (tramp-file-property-p
+       vec (tramp-file-name-localname vec) "file-attributes")))
+
 (defmacro tramp-skeleton-file-exists-p (filename &rest body)
   "Skeleton for `tramp-*-handle-file-exists-p'.
 BODY is the backend specific code."
@@ -3460,7 +3474,7 @@ BODY is the backend specific code."
           (with-tramp-file-property v localname "file-exists-p"
             ;; Examine `file-attributes' cache to see if request can
             ;; be satisfied without remote operation.
-            (if (tramp-file-property-p v localname "file-attributes")
+            (if (tramp-use-file-attributes v)
                 (not
                  (null (tramp-get-file-property v localname "file-attributes")))
               ,@body))))))