aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorK. Handa2019-08-04 21:15:27 +0900
committerK. Handa2019-08-04 21:15:27 +0900
commit9b7d25e481ebe2085aafbac983106d210b469b3a (patch)
tree9dde60e74a612a4bae5d2c9879df7fb141b7ec4f
parenta8026dfde9734a03ad03a9872ec801871dd1d81a (diff)
parent151a99cca92997dd4936e679c7efc2c2bafa0f72 (diff)
downloademacs-9b7d25e481ebe2085aafbac983106d210b469b3a.tar.gz
emacs-9b7d25e481ebe2085aafbac983106d210b469b3a.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
-rw-r--r--doc/lispref/functions.texi3
-rw-r--r--lisp/net/tramp-gvfs.el49
-rw-r--r--lisp/net/tramp.el9
-rw-r--r--test/lisp/net/tramp-tests.el11
4 files changed, 65 insertions, 7 deletions
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 6eb1af68de0..28da3cfb992 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -1707,7 +1707,8 @@ If @var{function} is not interactive, then the combined function will inherit
1707the interactive spec, if any, of the original function. Else, the combined 1707the interactive spec, if any, of the original function. Else, the combined
1708function will be interactive and will use the interactive spec of 1708function will be interactive and will use the interactive spec of
1709@var{function}. One exception: if the interactive spec of @var{function} 1709@var{function}. One exception: if the interactive spec of @var{function}
1710is a function (rather than an expression or a string), then the interactive 1710is a function (i.e., a @code{lambda} expression or an @code{fbound}
1711symbol rather than an expression or a string), then the interactive
1711spec of the combined function will be a call to that function with as sole 1712spec of the combined function will be a call to that function with as sole
1712argument the interactive spec of the original function. To interpret the spec 1713argument the interactive spec of the original function. To interpret the spec
1713received as argument, use @code{advice-eval-interactive-spec}. 1714received as argument, use @code{advice-eval-interactive-spec}.
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 9d45e6a8ce9..a606ba67177 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -471,6 +471,7 @@ It has been changed in GVFS 1.14.")
471 ("gvfs-mount" . "mount") 471 ("gvfs-mount" . "mount")
472 ("gvfs-move" . "move") 472 ("gvfs-move" . "move")
473 ("gvfs-rm" . "remove") 473 ("gvfs-rm" . "remove")
474 ("gvfs-set-attribute" . "set")
474 ("gvfs-trash" . "trash")) 475 ("gvfs-trash" . "trash"))
475 "List of cons cells, mapping \"gvfs-<command>\" to \"gio <command>\".") 476 "List of cons cells, mapping \"gvfs-<command>\" to \"gio <command>\".")
476 477
@@ -590,15 +591,15 @@ It has been changed in GVFS 1.14.")
590 (process-file . ignore) 591 (process-file . ignore)
591 (rename-file . tramp-gvfs-handle-rename-file) 592 (rename-file . tramp-gvfs-handle-rename-file)
592 (set-file-acl . ignore) 593 (set-file-acl . ignore)
593 (set-file-modes . ignore) 594 (set-file-modes . tramp-gvfs-handle-set-file-modes)
594 (set-file-selinux-context . ignore) 595 (set-file-selinux-context . ignore)
595 (set-file-times . ignore) 596 (set-file-times . tramp-gvfs-handle-set-file-times)
596 (set-visited-file-modtime . tramp-handle-set-visited-file-modtime) 597 (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
597 (shell-command . ignore) 598 (shell-command . ignore)
598 (start-file-process . ignore) 599 (start-file-process . ignore)
599 (substitute-in-file-name . tramp-handle-substitute-in-file-name) 600 (substitute-in-file-name . tramp-handle-substitute-in-file-name)
600 (temporary-file-directory . tramp-handle-temporary-file-directory) 601 (temporary-file-directory . tramp-handle-temporary-file-directory)
601 (tramp-set-file-uid-gid . ignore) 602 (tramp-set-file-uid-gid . tramp-gvfs-handle-set-file-uid-gid)
602 (unhandled-file-name-directory . ignore) 603 (unhandled-file-name-directory . ignore)
603 (vc-registered . ignore) 604 (vc-registered . ignore)
604 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime) 605 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
@@ -1325,6 +1326,48 @@ file-notify events."
1325 (tramp-run-real-handler 1326 (tramp-run-real-handler
1326 #'rename-file (list filename newname ok-if-already-exists)))) 1327 #'rename-file (list filename newname ok-if-already-exists))))
1327 1328
1329(defun tramp-gvfs-handle-set-file-modes (filename mode)
1330 "Like `set-file-modes' for Tramp files."
1331 (with-parsed-tramp-file-name filename nil
1332 (tramp-flush-file-properties v (file-name-directory localname))
1333 (tramp-flush-file-properties v localname)
1334 (tramp-gvfs-send-command
1335 v "gvfs-set-attribute" "-t" "uint32"
1336 (tramp-gvfs-url-file-name (tramp-make-tramp-file-name v))
1337 "unix::mode" (number-to-string mode))))
1338
1339(defun tramp-gvfs-handle-set-file-times (filename &optional time)
1340 "Like `set-file-times' for Tramp files."
1341 (with-parsed-tramp-file-name filename nil
1342 (tramp-flush-file-properties v (file-name-directory localname))
1343 (tramp-flush-file-properties v localname)
1344 (let ((time
1345 (if (or (null time)
1346 (tramp-compat-time-equal-p time tramp-time-doesnt-exist)
1347 (tramp-compat-time-equal-p time tramp-time-dont-know))
1348 (current-time)
1349 time)))
1350 (tramp-gvfs-send-command
1351 v "gvfs-set-attribute" "-t" "uint64"
1352 (tramp-gvfs-url-file-name (tramp-make-tramp-file-name v))
1353 "time::modified" (format-time-string "%s" time)))))
1354
1355(defun tramp-gvfs-set-file-uid-gid (filename &optional uid gid)
1356 "Like `tramp-set-file-uid-gid' for Tramp files."
1357 (with-parsed-tramp-file-name filename nil
1358 (tramp-flush-file-properties v (file-name-directory localname))
1359 (tramp-flush-file-properties v localname)
1360 (when (natnump uid)
1361 (tramp-gvfs-send-command
1362 v "gvfs-set-attribute" "-t" "uint32"
1363 (tramp-gvfs-url-file-name (tramp-make-tramp-file-name v))
1364 "unix::uid" (number-to-string uid)))
1365 (when (natnump gid)
1366 (tramp-gvfs-send-command
1367 v "gvfs-set-attribute" "-t" "uint32"
1368 (tramp-gvfs-url-file-name (tramp-make-tramp-file-name v))
1369 "unix::gid" (number-to-string gid)))))
1370
1328 1371
1329;; File name conversions. 1372;; File name conversions.
1330 1373
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 717ced80f28..c589557132a 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3772,9 +3772,16 @@ of."
3772 (format "File %s exists; overwrite anyway? " filename))))) 3772 (format "File %s exists; overwrite anyway? " filename)))))
3773 (tramp-error v 'file-already-exists filename)) 3773 (tramp-error v 'file-already-exists filename))
3774 3774
3775 (let ((tmpfile (tramp-compat-make-temp-file filename))) 3775 (let ((tmpfile (tramp-compat-make-temp-file filename))
3776 (modes (save-excursion (tramp-default-file-modes filename))))
3776 (when (and append (file-exists-p filename)) 3777 (when (and append (file-exists-p filename))
3777 (copy-file filename tmpfile 'ok)) 3778 (copy-file filename tmpfile 'ok))
3779 ;; The permissions of the temporary file should be set. If
3780 ;; FILENAME does not exist (eq modes nil) it has been
3781 ;; renamed to the backup file. This case `save-buffer'
3782 ;; handles permissions.
3783 ;; Ensure that it is still readable.
3784 (set-file-modes tmpfile (logior (or modes 0) #o0400))
3778 ;; We say `no-message' here because we don't want the visited file 3785 ;; We say `no-message' here because we don't want the visited file
3779 ;; modtime data to be clobbered from the temp file. We call 3786 ;; modtime data to be clobbered from the temp file. We call
3780 ;; `set-visited-file-modtime' ourselves later on. 3787 ;; `set-visited-file-modtime' ourselves later on.
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 1404ef39d55..f60dea36bf5 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -3143,7 +3143,13 @@ They might differ only in access time."
3143 "Check `file-modes'. 3143 "Check `file-modes'.
3144This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." 3144This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
3145 (skip-unless (tramp--test-enabled)) 3145 (skip-unless (tramp--test-enabled))
3146 (skip-unless (or (tramp--test-sh-p) (tramp--test-sudoedit-p))) 3146 (skip-unless
3147 (or (tramp--test-sh-p) (tramp--test-sudoedit-p)
3148 ;; Not all tramp-gvfs.el methods support changing the file mode.
3149 (and
3150 (tramp--test-gvfs-p)
3151 (string-match-p
3152 "ftp" (file-remote-p tramp-test-temporary-file-directory 'method)))))
3147 3153
3148 (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) 3154 (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
3149 (let ((tmp-name (tramp--test-make-temp-name nil quoted))) 3155 (let ((tmp-name (tramp--test-make-temp-name nil quoted)))
@@ -3443,7 +3449,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3443 "Check `set-file-times' and `file-newer-than-file-p'." 3449 "Check `set-file-times' and `file-newer-than-file-p'."
3444 (skip-unless (tramp--test-enabled)) 3450 (skip-unless (tramp--test-enabled))
3445 (skip-unless 3451 (skip-unless
3446 (or (tramp--test-adb-p) (tramp--test-sh-p) (tramp--test-sudoedit-p))) 3452 (or (tramp--test-adb-p) (tramp--test-gvfs-p)
3453 (tramp--test-sh-p) (tramp--test-sudoedit-p)))
3447 3454
3448 (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) 3455 (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
3449 (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) 3456 (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))