Adapt PuTTY integration into Tramp

* doc/misc/tramp.texi (Inline methods, External methods):
PuTTY must be at least version 0.82.

* lisp/net/tramp-cache.el (with-tramp-saved-connection-property)
(with-tramp-saved-connection-properties): Add traces.

* lisp/net/tramp-sh.el (tramp-methods) <plink, plinkx, pscp, psftp>:
Adapt `tramp-login-args' and `tramp-copy-args' arguments.  (Bug#75746)
This commit is contained in:
Michael Albinus 2025-02-14 15:21:30 +01:00
parent 608113628c
commit 9ded6fd73e
3 changed files with 22 additions and 4 deletions

View file

@ -955,9 +955,10 @@ This is another method from the Kerberos suite. It behaves like
@cindex @option{plink} method
@item @option{plink}
@option{plink} method is for MS Windows users with the PuTTY
implementation of SSH@. It uses @samp{plink -ssh} to log in to the
remote host. It supports changing the remote login shell @command{/bin/sh}.
@option{plink} method is for MS Windows users with the
PuTTY@footnote{It requires at least PuTTY 0.82.} implementation of
SSH@. It uses @samp{plink -ssh} to log in to the remote host. It
supports changing the remote login shell @command{/bin/sh}.
Check the @samp{Share SSH connections if possible} control for that
session.
@ -1190,7 +1191,8 @@ This method supports the @samp{-p} argument.
These methods are similar to @option{scp} or @option{sftp}, but they
use the @command{plink} command to connect to the remote host, and
they use @command{pscp} or @command{psftp} for transferring the files.
These programs are part of PuTTY, an SSH implementation for MS Windows.
These programs are part of PuTTY@footnote{It requires at least PuTTY
0.82.}, an SSH implementation for MS Windows.
They support changing the remote login shell @command{/bin/sh}.

View file

@ -482,8 +482,10 @@ used to cache connection properties of the local machine."
(hash (tramp-get-hash-table key))
(cached (and (hash-table-p hash)
(gethash ,property hash tramp-cache-undefined))))
(tramp-message key 7 "Saved %s %s" property cached)
(unwind-protect (progn ,@body)
;; Reset PROPERTY. Recompute hash, it could have been flushed.
(tramp-message key 7 "Restored %s %s" property cached)
(setq hash (tramp-get-hash-table key))
(if (not (eq cached tramp-cache-undefined))
(puthash ,property cached hash)
@ -501,8 +503,10 @@ PROPERTIES is a list of file properties (strings)."
(lambda (property)
(cons property (gethash property hash tramp-cache-undefined)))
,properties)))
(tramp-message key 7 "Saved %s" values)
(unwind-protect (progn ,@body)
;; Reset PROPERTIES. Recompute hash, it could have been flushed.
(tramp-message key 7 "Restored %s" values)
(setq hash (tramp-get-hash-table key))
(dolist (value values)
(if (not (eq (cdr value) tramp-cache-undefined))

View file

@ -322,6 +322,8 @@ The string is used in `tramp-methods'.")
`("plink"
(tramp-login-program "plink")
(tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%c")
;; Since PuTTY 0.82.
("-legacy-stdio-prompts")
("-t") ("%h") ("\"")
(,(format
"env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
@ -335,6 +337,8 @@ The string is used in `tramp-methods'.")
`("plinkx"
(tramp-login-program "plink")
(tramp-login-args (("-load") ("%h") ("%c") ("-t") ("\"")
;; Since PuTTY 0.82.
("-legacy-stdio-prompts")
(,(format
"env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
tramp-terminal-type
@ -347,6 +351,8 @@ The string is used in `tramp-methods'.")
`("pscp"
(tramp-login-program "plink")
(tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%c")
;; Since PuTTY 0.82.
("-legacy-stdio-prompts")
("-t") ("%h") ("\"")
(,(format
"env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
@ -358,6 +364,8 @@ The string is used in `tramp-methods'.")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "pscp")
(tramp-copy-args (("-l" "%u") ("-P" "%p") ("-scp")
;; Since PuTTY 0.82.
("-legacy-stdio-prompts")
("-p" "%k") ("-q") ("-r")))
(tramp-copy-keep-date t)
(tramp-copy-recursive t)))
@ -365,6 +373,8 @@ The string is used in `tramp-methods'.")
`("psftp"
(tramp-login-program "plink")
(tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%c")
;; Since PuTTY 0.82.
("-legacy-stdio-prompts")
("-t") ("%h") ("\"")
(,(format
"env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
@ -376,6 +386,8 @@ The string is used in `tramp-methods'.")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "pscp")
(tramp-copy-args (("-l" "%u") ("-P" "%p") ("-sftp")
;; Since PuTTY 0.82.
("-legacy-stdio-prompts")
("-p" "%k")))
(tramp-copy-keep-date t)))