diff options
| author | Michael Albinus | 2019-04-08 13:34:54 +0200 |
|---|---|---|
| committer | Michael Albinus | 2019-04-08 13:34:54 +0200 |
| commit | a20845c160de2ba9f42b3af714d770df502d0577 (patch) | |
| tree | 82a0c07f09d8259ccae2c6d6f93e6a5eaecf910f | |
| parent | 0b8117ed1abfc17bb0bc1690a8997736f1e8f98c (diff) | |
| download | emacs-a20845c160de2ba9f42b3af714d770df502d0577.tar.gz emacs-a20845c160de2ba9f42b3af714d770df502d0577.zip | |
Fix file-readable-p and file-executable-p in some Tramp backends
* lisp/net/tramp-archive.el (tramp-archive-handle-file-readable-p):
Use tramp-gvfs.
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-executable-p):
Check that FILENAME exists.
(tramp-gvfs-handle-file-readable-p): Check that FILENAME exists.
Use heuristic in case it cannot be determined correctly.
| -rw-r--r-- | lisp/net/tramp-archive.el | 4 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 18 |
2 files changed, 17 insertions, 5 deletions
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index 9e131b1a47d..ba4c26cdf2f 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el | |||
| @@ -584,9 +584,7 @@ offered." | |||
| 584 | 584 | ||
| 585 | (defun tramp-archive-handle-file-readable-p (filename) | 585 | (defun tramp-archive-handle-file-readable-p (filename) |
| 586 | "Like `file-readable-p' for file archives." | 586 | "Like `file-readable-p' for file archives." |
| 587 | (with-parsed-tramp-file-name | 587 | (file-readable-p (tramp-archive-gvfs-file-name filename))) |
| 588 | (tramp-archive-gvfs-file-name filename) nil | ||
| 589 | (tramp-check-cached-permissions v ?r))) | ||
| 590 | 588 | ||
| 591 | (defun tramp-archive-handle-file-system-info (filename) | 589 | (defun tramp-archive-handle-file-system-info (filename) |
| 592 | "Like `file-system-info' for file archives." | 590 | "Like `file-system-info' for file archives." |
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 2d8f42004a8..8fea82d97c4 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -1136,7 +1136,8 @@ If FILE-SYSTEM is non-nil, return file system attributes." | |||
| 1136 | "Like `file-executable-p' for Tramp files." | 1136 | "Like `file-executable-p' for Tramp files." |
| 1137 | (with-parsed-tramp-file-name filename nil | 1137 | (with-parsed-tramp-file-name filename nil |
| 1138 | (with-tramp-file-property v localname "file-executable-p" | 1138 | (with-tramp-file-property v localname "file-executable-p" |
| 1139 | (tramp-check-cached-permissions v ?x)))) | 1139 | (and (file-exists-p filename) |
| 1140 | (tramp-check-cached-permissions v ?x))))) | ||
| 1140 | 1141 | ||
| 1141 | (defun tramp-gvfs-handle-file-name-all-completions (filename directory) | 1142 | (defun tramp-gvfs-handle-file-name-all-completions (filename directory) |
| 1142 | "Like `file-name-all-completions' for Tramp files." | 1143 | "Like `file-name-all-completions' for Tramp files." |
| @@ -1258,7 +1259,20 @@ file-notify events." | |||
| 1258 | "Like `file-readable-p' for Tramp files." | 1259 | "Like `file-readable-p' for Tramp files." |
| 1259 | (with-parsed-tramp-file-name filename nil | 1260 | (with-parsed-tramp-file-name filename nil |
| 1260 | (with-tramp-file-property v localname "file-readable-p" | 1261 | (with-tramp-file-property v localname "file-readable-p" |
| 1261 | (tramp-check-cached-permissions v ?r)))) | 1262 | (and (file-exists-p filename) |
| 1263 | (or (tramp-check-cached-permissions v ?r) | ||
| 1264 | ;; If the user is different from what we guess to be | ||
| 1265 | ;; the user, we don't know. Let's check, whether | ||
| 1266 | ;; access is restricted explicitly. | ||
| 1267 | (and (/= (tramp-gvfs-get-remote-uid v 'integer) | ||
| 1268 | (tramp-compat-file-attribute-user-id | ||
| 1269 | (file-attributes filename 'integer))) | ||
| 1270 | (not | ||
| 1271 | (string-equal | ||
| 1272 | "FALSE" | ||
| 1273 | (cdr (assoc | ||
| 1274 | "access::can-read" | ||
| 1275 | (tramp-gvfs-get-file-attributes filename))))))))))) | ||
| 1262 | 1276 | ||
| 1263 | (defun tramp-gvfs-handle-file-system-info (filename) | 1277 | (defun tramp-gvfs-handle-file-system-info (filename) |
| 1264 | "Like `file-system-info' for Tramp files." | 1278 | "Like `file-system-info' for Tramp files." |