summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-adb.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2020-02-25 13:25:57 +0100
committerMichael Albinus <michael.albinus@gmx.de>2020-02-25 13:25:57 +0100
commit64af3c94a6197cd0c6a283880c900eeb5bf12961 (patch)
treede19019883ef7c94e21ec26615ee226a8d0cd67a /lisp/net/tramp-adb.el
parent22524a6e39582d44c1365bad9a589618c2b0df27 (diff)
downloademacs-64af3c94a6197cd0c6a283880c900eeb5bf12961.tar.gz
emacs-64af3c94a6197cd0c6a283880c900eeb5bf12961.tar.bz2
emacs-64af3c94a6197cd0c6a283880c900eeb5bf12961.zip
Finish implementation of {set-}file-modes FLAG arg in Tramp
* lisp/net/tramp-adb.el (tramp-adb-handle-file-local-copy): Do not use 'nofollow for temporary files. Use `tramp-compat-set-file-modes'. (tramp-adb-handle-write-region): Do not use 'nofollow for temporary files. (tramp-adb-handle-set-file-modes): Implement FLAG. * lisp/net/tramp-compat.el (tramp-compat-file-modes) (tramp-compat-set-file-modes): New defaliases. * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-set-file-modes): Make explicit check (eq flag 'nofollow). * lisp/net/tramp-sh.el (tramp-sh-handle-set-file-modes): Implement FLAG. (tramp-do-copy-or-rename-file-directly) (tramp-sh-handle-file-local-copy, tramp-sh-handle-write-region): Do not use 'nofollow for temporary files. (tramp-get-remote-chmod-h): New defun. * lisp/net/tramp-smb.el (tramp-smb-handle-set-file-modes): Implement FLAG. * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-modes): Implement FLAG. (tramp-sudoedit-handle-write-region): Use `tramp-compat-set-file-modes'. * lisp/net/tramp.el (tramp-default-file-modes): Optional argument FLAG. (tramp-handle-file-modes): Use `file-truename' instead of `file-chase-links'. The latter function does not work for remote file names. (tramp-handle-write-region): Call `tramp-default-file-modes' with 'nofollow if needed. Do not use 'nofollow for temporary files. * test/lisp/net/tramp-tests.el (tramp--test-ignore-make-symbolic-link-error): Check also for "Cannot chmod .* with nofollow flag" error. (tramp-test20-file-modes): Extend test. (tramp--test-emacs28-p): New defun.
Diffstat (limited to 'lisp/net/tramp-adb.el')
-rw-r--r--lisp/net/tramp-adb.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 96ef95dbe30..a118e7d2143 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -591,8 +591,9 @@ Emacs dired can't find files."
(ignore-errors (delete-file tmpfile))
(tramp-error
v 'file-error "Cannot make local copy of file `%s'" filename))
- (set-file-modes tmpfile (logior (or (file-modes filename) 0) #o0400)
- 'nofollow))
+ (set-file-modes
+ tmpfile
+ (logior (or (tramp-compat-file-modes filename 'nofollow) 0) #o0400)))
tmpfile)))
(defun tramp-adb-handle-file-writable-p (filename)
@@ -637,8 +638,7 @@ But handle the case, if the \"test\" command is not available."
(tmpfile (tramp-compat-make-temp-file filename)))
(when (and append (file-exists-p filename))
(copy-file filename tmpfile 'ok)
- (set-file-modes tmpfile (logior (or (file-modes tmpfile) 0) #o0600)
- 'nofollow))
+ (set-file-modes tmpfile (logior (or (file-modes tmpfile) 0) #o0600)))
(tramp-run-real-handler
#'write-region (list start end tmpfile append 'no-message lockname))
(with-tramp-progress-reporter
@@ -669,8 +669,9 @@ But handle the case, if the \"test\" command is not available."
(defun tramp-adb-handle-set-file-modes (filename mode &optional flag)
"Like `set-file-modes' for Tramp files."
- flag ;; FIXME: Support 'nofollow'.
(with-parsed-tramp-file-name filename nil
+ (when (and (eq flag 'nofollow) (file-symlink-p filename))
+ (tramp-error v 'file-error "Cannot chmod %s with %s flag" filename flag))
(tramp-flush-file-properties v localname)
(tramp-adb-send-command-and-check v (format "chmod %o %s" mode localname))))