1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Don't report files from read-only adb partitions as writable

* lisp/net/tramp-adb.el (tramp-adb-handle-file-writable-p):
Ignore the file-attributes cache, since file mode is not a
reliable indicator of writability.
This commit is contained in:
Po Lu 2024-03-06 10:48:28 +08:00
parent 845d334c10
commit 1a5850a3af

View file

@ -508,12 +508,11 @@ Emacs dired can't find files."
(with-parsed-tramp-file-name (expand-file-name filename) nil
(with-tramp-file-property v localname "file-writable-p"
(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")
(tramp-check-cached-permissions v ?w)
(tramp-adb-send-command-and-check
v (format "test -w %s" (tramp-shell-quote-argument localname))))
;; The file-attributes cache is unreliable since its
;; information does not take partition writability into
;; account, so a call to test must never be skipped.
(tramp-adb-send-command-and-check
v (format "test -w %s" (tramp-shell-quote-argument localname)))
;; If file doesn't exist, check if directory is writable.
(and
(file-directory-p (file-name-directory filename))