* 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.
(cherry picked from commit
90234ba7f024f3dae342689b47930835e4904503)
@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?
(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
(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)))))))
(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.
(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)))))
(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)))))
(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.
(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
(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))))))
(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)))
(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."
(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))))))