Tramp: handle non-standard file system like GPFS
* 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.
This commit is contained in:
parent
275a558241
commit
90234ba7f0
5 changed files with 36 additions and 10 deletions
|
@ -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?
|
||||
|
||||
|
|
|
@ -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)))))))
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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))))))
|
||||
|
|
Loading…
Add table
Reference in a new issue