Re: Separate default method for multi-hop files
Michael Albinus <[email protected]> Sun, 04 Jan 2026 11:24:06 +0100
| Newsgroups | gmane.emacs.tramp |
|---|---|
| Message-ID | <[email protected]> |
--=-=-= Content-Type: text/plain "J.D. Smith" <[email protected]> writes: Hi, >> Tramp doesn't offer such a user option. But thinking about, I come back >> to an old idea slumbering on my TODO: Make external methods (like scp, >> rsync) multi-hop capable. >> >> It shouldn't be too hard. As you know, Tramp distinguishes between >> inline and external methods, like ssh and scp. The major difference is >> copying large files, which is performed by the scp command. For >> everything else, both use the same code. >> >> In theory, it should be possible to add another check for external Tramp >> methods: If they are used inside a multi-hop connection, don't use the >> external command. Then, they should behave identically. > > That sounds like a better plan indeed! I've compiled a small patch which should make this happen. Would you like to check? Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable diff --git a/lisp/tramp-sh.el b/lisp/tramp-sh.el index e7e21684..1aa114e7 100644 =2D-- a/lisp/tramp-sh.el +++ b/lisp/tramp-sh.el @@ -5677,8 +5677,9 @@ raises an error." (defun tramp-method-out-of-band-p (vec size) "Return t if this is an out-of-band method, nil otherwise." (and - ;; It shall be an out-of-band method. - (tramp-get-method-parameter vec 'tramp-copy-program) + ;; There shouldn't be a multi-hop. + (or (not (tramp-multi-hop-p vec)) + (null (cdr (tramp-compute-multi-hops vec)))) ;; There must be a size, otherwise the file doesn't exist. (numberp size) ;; Either the file size is large enough, or (in rare cases) there diff --git a/lisp/tramp.el b/lisp/tramp.el index ebbe6df0..39d3d073 100644 =2D-- a/lisp/tramp.el +++ b/lisp/tramp.el @@ -296,9 +296,8 @@ pair of the form (KEY VALUE). The following KEYs are = defined: - \"%a\" adds the pseudo-terminal allocation argument \"-t\" in asynchronous processes, if the connection type is not `pipe'. =20 - The existence of `tramp-login-args', combined with the - absence of `tramp-copy-args', is an indication that the - method is capable of multi-hops. + The existence of `tramp-login-args' is an indication that the method + is capable of multi-hops. =20 * `tramp-async-args' When an asynchronous process is started, we know already that @@ -5148,7 +5147,7 @@ Do not set it manually, it is used buffer-local in `= tramp-get-lock-pid'.") "Whether the method of VEC is capable of multi-hops." (let ((tramp-verbose 0)) (and (tramp-sh-file-name-handler-p vec) - (not (tramp-get-method-parameter vec 'tramp-copy-program))))) + (tramp-get-method-parameter vec 'tramp-login-args)))) =20 (defun tramp-add-hops (vec) "Add ad-hoc proxy definitions to `tramp-default-proxies-alist'." --=-=-=--