diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2021-03-11 17:16:50 +0100 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2021-03-11 17:16:50 +0100 |
commit | 65441a6fab7a24d2433411119191002cb366c96d (patch) | |
tree | cfb5e1a769b2fc8b5ccd600b36c4cb7f7e5b6778 /lisp/net/tramp.el | |
parent | 62610da8c44ae864d21a1f1e12bd4444e688eaf6 (diff) | |
download | emacs-65441a6fab7a24d2433411119191002cb366c96d.tar.gz emacs-65441a6fab7a24d2433411119191002cb366c96d.tar.bz2 emacs-65441a6fab7a24d2433411119191002cb366c96d.zip |
Add remote processes to Tramp sshfs method
* doc/misc/tramp.texi (FUSE setup): Method sshfs supports also
remote processes.
* lisp/net/tramp-cache.el (tramp-get-file-property)
(tramp-set-file-property): Move setting of
`tramp-cache-unload-hook' out of function.
* lisp/net/tramp.el (tramp-expand-args): New defun.
(tramp-handle-make-process):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-maybe-open-connection):
* lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-send-command): Use it.
* lisp/net/tramp-sshfs.el (tramp-methods) <sshfs>:
Adapt `tramp-mount-args'. Add `tramp-login-args',
`tramp-direct-async', `tramp-remote-shell',
`tramp-remote-shell-login' and `tramp-remote-shell-args'.
(tramp-connection-properties): Set "direct-async-process" fir sshfs.
(tramp-sshfs-file-name-handler-alist): Add `exec-path',
`make-process', `process-file', `set-file-modes', `shell-command',
`start-file-process', `tramp-get-remote-gid',
`tramp-get-remote-uid' and `tramp-set-file-uid-gid'.
(tramp-sshfs-handle-exec-path, tramp-sshfs-handle-process-file)
(tramp-sshfs-handle-set-file-modes): New defuns.
* test/lisp/net/tramp-tests.el (tramp-test20-file-modes)
(tramp-test28-process-file, tramp-test29-start-file-process)
(tramp-test30-make-process, tramp-test32-shell-command)
(tramp-test32-shell-command-dont-erase-buffer)
(tramp-test34-explicit-shell-file-name, tramp-test35-exec-path)
(tramp-test43-asynchronous-requests): Run also for tramp-sshfs.
(tramp--test-shell-file-name): New defun.
(tramp-test28-process-file)
(tramp-test34-explicit-shell-file-name)
(tramp-test43-asynchronous-requests): Use it.
(tramp-test40-special-characters-with-stat)
(tramp-test40-special-characters-with-perl)
(tramp-test40-special-characters-with-ls)
(tramp-test41-utf8-with-stat, tramp-test41-utf8-with-perl)
(tramp-test41-utf8-with-ls): Remove superfluous skip.
Diffstat (limited to 'lisp/net/tramp.el')
-rw-r--r-- | lisp/net/tramp.el | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 9f65608f3a4..da779d3386f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3765,6 +3765,22 @@ User is always nil." ;; Result. target-alist)) +(defun tramp-expand-args (vec parameter &rest spec-list) + "Expand login arguments as given by PARAMETER in `tramp-methods'. +PARAMETER is a symbol like `tramp-login-args', denoting a list of +list of strings from `tramp-methods', containing %-sequences for +substitution. SPEC-LIST is a list of char/value pairs used for +`format-spec-make'." + (let ((args (tramp-get-method-parameter vec parameter)) + (spec (apply 'format-spec-make spec-list))) + ;; Expand format spec. + (tramp-compat-flatten-tree + (mapcar + (lambda (x) + (setq x (mapcar (lambda (y) (format-spec y spec)) x)) + (unless (member "" x) x)) + args)))) + (defun tramp-direct-async-process-p (&rest args) "Whether direct async `make-process' can be called." (let ((v (tramp-dissect-file-name default-directory)) @@ -3846,14 +3862,11 @@ It does not support `:stderr'." (append `("cd" ,localname "&&" "(" "env") env `(,command ")")))) ;; Check for `tramp-sh-file-name-handler', because something - ;; is different between tramp-adb.el and tramp-sh.el. + ;; is different between tramp-sh.el, and tramp-adb.el or + ;; tramp-sshfs.el. (let* ((sh-file-name-handler-p (tramp-sh-file-name-handler-p v)) (login-program (tramp-get-method-parameter v 'tramp-login-program)) - (login-args - (tramp-get-method-parameter v 'tramp-login-args)) - (async-args - (tramp-get-method-parameter v 'tramp-async-args)) ;; We don't create the temporary file. In fact, it ;; is just a prefix for the ControlPath option of ;; ssh; the real temporary file has another name, and @@ -3871,29 +3884,23 @@ It does not support `:stderr'." (when sh-file-name-handler-p (tramp-compat-funcall 'tramp-ssh-controlmaster-options v))) - spec p) + login-args p) - ;; Replace `login-args' place holders. + ;; Replace `login-args' place holders. Split + ;; ControlMaster options. (setq - spec (format-spec-make ?t tmpfile) - options (format-spec (or options "") spec) - spec (format-spec-make - ?h (or host "") ?u (or user "") ?p (or port "") - ?c options ?l "") - ;; Add arguments for asynchronous processes. - login-args (append async-args login-args) - ;; Expand format spec. login-args - (tramp-compat-flatten-tree - (mapcar - (lambda (x) - (setq x (mapcar (lambda (y) (format-spec y spec)) x)) - (unless (member "" x) x)) - login-args)) - ;; Split ControlMaster options. - login-args - (tramp-compat-flatten-tree - (mapcar (lambda (x) (split-string x " ")) login-args)) + (append + (tramp-compat-flatten-tree + (tramp-get-method-parameter v 'tramp-async-args)) + (tramp-compat-flatten-tree + (mapcar + (lambda (x) (split-string x " ")) + (tramp-expand-args + v 'tramp-login-args + ?h (or host "") ?u (or user "") ?p (or port "") + ?c (format-spec (or options "") (format-spec-make ?t tmpfile)) + ?l "")))) p (make-process :name name :buffer buffer :command (append `(,login-program) login-args command) |