diff options
| author | Michael Albinus | 2013-02-13 17:23:15 +0100 |
|---|---|---|
| committer | Michael Albinus | 2013-02-13 17:23:15 +0100 |
| commit | d7291032804bbb2f577ef1425dac37e8510181a3 (patch) | |
| tree | d10b450abf26f0a23a43aef421e9bd26a46d300d | |
| parent | 1ead7dbd665015ab579ecb17932281862376f1d4 (diff) | |
| download | emacs-d7291032804bbb2f577ef1425dac37e8510181a3.tar.gz emacs-d7291032804bbb2f577ef1425dac37e8510181a3.zip | |
Use ControlMaster where applicable. (Bug#13677)
* net/tramp.el (tramp-ssh-controlmaster-template): New defvar,
replacing `tramp-detect-ssh-controlmaster'.
(tramp-default-method): Use it.
* net/tramp-sh.el (tramp-methods) [scp, scp1, scp2, scpx, sftp]:
[rsync, ssh, ssh1, ssh2, sshx]: Add ControlPath and ControlMaster
arguments.
[scpc, rsyncc]: Remove methods.
(top): Remove completion functions for "scpc", "rsyncc", "ssh1_old"
and "ssh2_old".
(tramp-do-copy-or-rename-file-out-of-band): Change trace level.
(tramp-maybe-open-connection): Reuse tmpfile for ControlPath.
| -rw-r--r-- | lisp/ChangeLog | 17 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 134 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 46 |
3 files changed, 97 insertions, 100 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 810fa1db145..eb3f4f833f5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,20 @@ | |||
| 1 | 2013-02-13 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | Use ControlMaster where applicable. (Bug#13677) | ||
| 4 | |||
| 5 | * net/tramp.el (tramp-ssh-controlmaster-template): New defvar, | ||
| 6 | replacing `tramp-detect-ssh-controlmaster'. | ||
| 7 | (tramp-default-method): Use it. | ||
| 8 | |||
| 9 | * net/tramp-sh.el (tramp-methods) [scp, scp1, scp2, scpx, sftp]: | ||
| 10 | [rsync, ssh, ssh1, ssh2, sshx]: Add ControlPath and ControlMaster | ||
| 11 | arguments. | ||
| 12 | [scpc, rsyncc]: Remove methods. | ||
| 13 | (top): Remove completion functions for "scpc", "rsyncc", "ssh1_old" | ||
| 14 | and "ssh2_old". | ||
| 15 | (tramp-do-copy-or-rename-file-out-of-band): Change trace level. | ||
| 16 | (tramp-maybe-open-connection): Reuse tmpfile for ControlPath. | ||
| 17 | |||
| 1 | 2013-02-13 Stefan Monnier <monnier@iro.umontreal.ca> | 18 | 2013-02-13 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 19 | ||
| 3 | * emacs-lisp/package.el (package--initialized): Move before first use. | 20 | * emacs-lisp/package.el (package--initialized): Move before first use. |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 0c2a0aa385a..001a27f3b2e 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -109,31 +109,17 @@ detected as prompt when being sent on echoing hosts, therefore.") | |||
| 109 | (tramp-copy-keep-date t))) | 109 | (tramp-copy-keep-date t))) |
| 110 | ;;;###tramp-autoload | 110 | ;;;###tramp-autoload |
| 111 | (add-to-list 'tramp-methods | 111 | (add-to-list 'tramp-methods |
| 112 | '("scp" | 112 | `("scp" |
| 113 | (tramp-login-program "ssh") | ||
| 114 | (tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h"))) | ||
| 115 | (tramp-async-args (("-q"))) | ||
| 116 | (tramp-remote-shell "/bin/sh") | ||
| 117 | (tramp-remote-shell-args ("-c")) | ||
| 118 | (tramp-copy-program "scp") | ||
| 119 | (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r"))) | ||
| 120 | (tramp-copy-keep-date t) | ||
| 121 | (tramp-copy-recursive t) | ||
| 122 | (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") | ||
| 123 | ("-o" "UserKnownHostsFile=/dev/null") | ||
| 124 | ("-o" "StrictHostKeyChecking=no"))) | ||
| 125 | (tramp-default-port 22))) | ||
| 126 | ;;;###tramp-autoload | ||
| 127 | (add-to-list 'tramp-methods | ||
| 128 | '("scp1" | ||
| 129 | (tramp-login-program "ssh") | 113 | (tramp-login-program "ssh") |
| 130 | (tramp-login-args (("-l" "%u") ("-p" "%p") | 114 | (tramp-login-args (("-l" "%u") ("-p" "%p") |
| 131 | ("-1") ("-e" "none") ("%h"))) | 115 | ,tramp-ssh-controlmaster-template |
| 116 | ("-e" "none") ("%h"))) | ||
| 132 | (tramp-async-args (("-q"))) | 117 | (tramp-async-args (("-q"))) |
| 133 | (tramp-remote-shell "/bin/sh") | 118 | (tramp-remote-shell "/bin/sh") |
| 134 | (tramp-remote-shell-args ("-c")) | 119 | (tramp-remote-shell-args ("-c")) |
| 135 | (tramp-copy-program "scp") | 120 | (tramp-copy-program "scp") |
| 136 | (tramp-copy-args (("-1") ("-P" "%p") ("-p" "%k") ("-q") ("-r"))) | 121 | (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r") |
| 122 | ,tramp-ssh-controlmaster-template)) | ||
| 137 | (tramp-copy-keep-date t) | 123 | (tramp-copy-keep-date t) |
| 138 | (tramp-copy-recursive t) | 124 | (tramp-copy-recursive t) |
| 139 | (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") | 125 | (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") |
| @@ -142,15 +128,17 @@ detected as prompt when being sent on echoing hosts, therefore.") | |||
| 142 | (tramp-default-port 22))) | 128 | (tramp-default-port 22))) |
| 143 | ;;;###tramp-autoload | 129 | ;;;###tramp-autoload |
| 144 | (add-to-list 'tramp-methods | 130 | (add-to-list 'tramp-methods |
| 145 | '("scp2" | 131 | `("scp1" |
| 146 | (tramp-login-program "ssh") | 132 | (tramp-login-program "ssh") |
| 147 | (tramp-login-args (("-l" "%u") ("-p" "%p") | 133 | (tramp-login-args (("-l" "%u") ("-p" "%p") |
| 148 | ("-2") ("-e" "none") ("%h"))) | 134 | ,tramp-ssh-controlmaster-template |
| 135 | ("-1") ("-e" "none") ("%h"))) | ||
| 149 | (tramp-async-args (("-q"))) | 136 | (tramp-async-args (("-q"))) |
| 150 | (tramp-remote-shell "/bin/sh") | 137 | (tramp-remote-shell "/bin/sh") |
| 151 | (tramp-remote-shell-args ("-c")) | 138 | (tramp-remote-shell-args ("-c")) |
| 152 | (tramp-copy-program "scp") | 139 | (tramp-copy-program "scp") |
| 153 | (tramp-copy-args (("-2") ("-P" "%p") ("-p" "%k") ("-q") ("-r"))) | 140 | (tramp-copy-args (("-1") ("-P" "%p") ("-p" "%k") ("-q") ("-r") |
| 141 | ,tramp-ssh-controlmaster-template)) | ||
| 154 | (tramp-copy-keep-date t) | 142 | (tramp-copy-keep-date t) |
| 155 | (tramp-copy-recursive t) | 143 | (tramp-copy-recursive t) |
| 156 | (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") | 144 | (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") |
| @@ -159,19 +147,17 @@ detected as prompt when being sent on echoing hosts, therefore.") | |||
| 159 | (tramp-default-port 22))) | 147 | (tramp-default-port 22))) |
| 160 | ;;;###tramp-autoload | 148 | ;;;###tramp-autoload |
| 161 | (add-to-list 'tramp-methods | 149 | (add-to-list 'tramp-methods |
| 162 | '("scpc" | 150 | `("scp2" |
| 163 | (tramp-login-program "ssh") | 151 | (tramp-login-program "ssh") |
| 164 | (tramp-login-args (("-l" "%u") ("-p" "%p") | 152 | (tramp-login-args (("-l" "%u") ("-p" "%p") |
| 165 | ("-o" "ControlPath=%t.%%r@%%h:%%p") | 153 | ,tramp-ssh-controlmaster-template |
| 166 | ("-o" "ControlMaster=yes") | 154 | ("-2") ("-e" "none") ("%h"))) |
| 167 | ("-e" "none") ("%h"))) | ||
| 168 | (tramp-async-args (("-q"))) | 155 | (tramp-async-args (("-q"))) |
| 169 | (tramp-remote-shell "/bin/sh") | 156 | (tramp-remote-shell "/bin/sh") |
| 170 | (tramp-remote-shell-args ("-c")) | 157 | (tramp-remote-shell-args ("-c")) |
| 171 | (tramp-copy-program "scp") | 158 | (tramp-copy-program "scp") |
| 172 | (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r") | 159 | (tramp-copy-args (("-2") ("-P" "%p") ("-p" "%k") ("-q") ("-r") |
| 173 | ("-o" "ControlPath=%t.%%r@%%h:%%p") | 160 | ,tramp-ssh-controlmaster-template)) |
| 174 | ("-o" "ControlMaster=auto"))) | ||
| 175 | (tramp-copy-keep-date t) | 161 | (tramp-copy-keep-date t) |
| 176 | (tramp-copy-recursive t) | 162 | (tramp-copy-recursive t) |
| 177 | (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") | 163 | (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") |
| @@ -180,16 +166,17 @@ detected as prompt when being sent on echoing hosts, therefore.") | |||
| 180 | (tramp-default-port 22))) | 166 | (tramp-default-port 22))) |
| 181 | ;;;###tramp-autoload | 167 | ;;;###tramp-autoload |
| 182 | (add-to-list 'tramp-methods | 168 | (add-to-list 'tramp-methods |
| 183 | '("scpx" | 169 | `("scpx" |
| 184 | (tramp-login-program "ssh") | 170 | (tramp-login-program "ssh") |
| 185 | (tramp-login-args (("-l" "%u") ("-p" "%p") | 171 | (tramp-login-args (("-l" "%u") ("-p" "%p") |
| 186 | ("-e" "none") ("-t" "-t") | 172 | ,tramp-ssh-controlmaster-template |
| 187 | ("%h") ("/bin/sh"))) | 173 | ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh"))) |
| 188 | (tramp-async-args (("-q"))) | 174 | (tramp-async-args (("-q"))) |
| 189 | (tramp-remote-shell "/bin/sh") | 175 | (tramp-remote-shell "/bin/sh") |
| 190 | (tramp-remote-shell-args ("-c")) | 176 | (tramp-remote-shell-args ("-c")) |
| 191 | (tramp-copy-program "scp") | 177 | (tramp-copy-program "scp") |
| 192 | (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r"))) | 178 | (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r") |
| 179 | ,tramp-ssh-controlmaster-template)) | ||
| 193 | (tramp-copy-keep-date t) | 180 | (tramp-copy-keep-date t) |
| 194 | (tramp-copy-recursive t) | 181 | (tramp-copy-recursive t) |
| 195 | (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") | 182 | (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") |
| @@ -198,33 +185,22 @@ detected as prompt when being sent on echoing hosts, therefore.") | |||
| 198 | (tramp-default-port 22))) | 185 | (tramp-default-port 22))) |
| 199 | ;;;###tramp-autoload | 186 | ;;;###tramp-autoload |
| 200 | (add-to-list 'tramp-methods | 187 | (add-to-list 'tramp-methods |
| 201 | '("sftp" | 188 | `("sftp" |
| 202 | (tramp-login-program "ssh") | 189 | (tramp-login-program "ssh") |
| 203 | (tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h"))) | 190 | (tramp-login-args (("-l" "%u") ("-p" "%p") |
| 204 | (tramp-async-args (("-q"))) | 191 | ,tramp-ssh-controlmaster-template |
| 205 | (tramp-remote-shell "/bin/sh") | 192 | ("-e" "none") ("%h"))) |
| 206 | (tramp-remote-shell-args ("-c")) | ||
| 207 | (tramp-copy-program "sftp"))) | ||
| 208 | ;;;###tramp-autoload | ||
| 209 | (add-to-list 'tramp-methods | ||
| 210 | '("rsync" | ||
| 211 | (tramp-login-program "ssh") | ||
| 212 | (tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h"))) | ||
| 213 | (tramp-async-args (("-q"))) | 193 | (tramp-async-args (("-q"))) |
| 214 | (tramp-remote-shell "/bin/sh") | 194 | (tramp-remote-shell "/bin/sh") |
| 215 | (tramp-remote-shell-args ("-c")) | 195 | (tramp-remote-shell-args ("-c")) |
| 216 | (tramp-copy-program "rsync") | 196 | (tramp-copy-program "sftp") |
| 217 | (tramp-copy-args (("-e" "ssh") ("-t" "%k") ("-r"))) | 197 | (tramp-copy-args ,tramp-ssh-controlmaster-template))) |
| 218 | (tramp-copy-keep-date t) | 198 | ;;;###tramp-autoload |
| 219 | (tramp-copy-keep-tmpfile t) | ||
| 220 | (tramp-copy-recursive t))) | ||
| 221 | ;;;###tramp-autoload | ||
| 222 | (add-to-list 'tramp-methods | 199 | (add-to-list 'tramp-methods |
| 223 | `("rsyncc" | 200 | `("rsync" |
| 224 | (tramp-login-program "ssh") | 201 | (tramp-login-program "ssh") |
| 225 | (tramp-login-args (("-l" "%u") ("-p" "%p") | 202 | (tramp-login-args (("-l" "%u") ("-p" "%p") |
| 226 | ("-o" "ControlPath=%t.%%r@%%h:%%p") | 203 | ,tramp-ssh-controlmaster-template |
| 227 | ("-o" "ControlMaster=yes") | ||
| 228 | ("-e" "none") ("%h"))) | 204 | ("-e" "none") ("%h"))) |
| 229 | (tramp-async-args (("-q"))) | 205 | (tramp-async-args (("-q"))) |
| 230 | (tramp-remote-shell "/bin/sh") | 206 | (tramp-remote-shell "/bin/sh") |
| @@ -232,10 +208,11 @@ detected as prompt when being sent on echoing hosts, therefore.") | |||
| 232 | (tramp-copy-program "rsync") | 208 | (tramp-copy-program "rsync") |
| 233 | (tramp-copy-args (("-t" "%k") ("-r"))) | 209 | (tramp-copy-args (("-t" "%k") ("-r"))) |
| 234 | (tramp-copy-env (("RSYNC_RSH") | 210 | (tramp-copy-env (("RSYNC_RSH") |
| 235 | (,(concat | 211 | (,(mapconcat |
| 236 | "ssh" | 212 | 'identity |
| 237 | " -o ControlPath=%t.%%r@%%h:%%p" | 213 | (append |
| 238 | " -o ControlMaster=auto")))) | 214 | '("ssh") tramp-ssh-controlmaster-template) |
| 215 | " ")))) | ||
| 239 | (tramp-copy-keep-date t) | 216 | (tramp-copy-keep-date t) |
| 240 | (tramp-copy-keep-tmpfile t) | 217 | (tramp-copy-keep-tmpfile t) |
| 241 | (tramp-copy-recursive t))) | 218 | (tramp-copy-recursive t))) |
| @@ -255,9 +232,11 @@ detected as prompt when being sent on echoing hosts, therefore.") | |||
| 255 | (tramp-remote-shell-args ("-c")))) | 232 | (tramp-remote-shell-args ("-c")))) |
| 256 | ;;;###tramp-autoload | 233 | ;;;###tramp-autoload |
| 257 | (add-to-list 'tramp-methods | 234 | (add-to-list 'tramp-methods |
| 258 | '("ssh" | 235 | `("ssh" |
| 259 | (tramp-login-program "ssh") | 236 | (tramp-login-program "ssh") |
| 260 | (tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h"))) | 237 | (tramp-login-args (("-l" "%u") ("-p" "%p") |
| 238 | ,tramp-ssh-controlmaster-template | ||
| 239 | ("-e" "none") ("%h"))) | ||
| 261 | (tramp-async-args (("-q"))) | 240 | (tramp-async-args (("-q"))) |
| 262 | (tramp-remote-shell "/bin/sh") | 241 | (tramp-remote-shell "/bin/sh") |
| 263 | (tramp-remote-shell-args ("-c")) | 242 | (tramp-remote-shell-args ("-c")) |
| @@ -267,9 +246,10 @@ detected as prompt when being sent on echoing hosts, therefore.") | |||
| 267 | (tramp-default-port 22))) | 246 | (tramp-default-port 22))) |
| 268 | ;;;###tramp-autoload | 247 | ;;;###tramp-autoload |
| 269 | (add-to-list 'tramp-methods | 248 | (add-to-list 'tramp-methods |
| 270 | '("ssh1" | 249 | `("ssh1" |
| 271 | (tramp-login-program "ssh") | 250 | (tramp-login-program "ssh") |
| 272 | (tramp-login-args (("-l" "%u") ("-p" "%p") | 251 | (tramp-login-args (("-l" "%u") ("-p" "%p") |
| 252 | ,tramp-ssh-controlmaster-template | ||
| 273 | ("-1") ("-e" "none") ("%h"))) | 253 | ("-1") ("-e" "none") ("%h"))) |
| 274 | (tramp-async-args (("-q"))) | 254 | (tramp-async-args (("-q"))) |
| 275 | (tramp-remote-shell "/bin/sh") | 255 | (tramp-remote-shell "/bin/sh") |
| @@ -280,9 +260,10 @@ detected as prompt when being sent on echoing hosts, therefore.") | |||
| 280 | (tramp-default-port 22))) | 260 | (tramp-default-port 22))) |
| 281 | ;;;###tramp-autoload | 261 | ;;;###tramp-autoload |
| 282 | (add-to-list 'tramp-methods | 262 | (add-to-list 'tramp-methods |
| 283 | '("ssh2" | 263 | `("ssh2" |
| 284 | (tramp-login-program "ssh") | 264 | (tramp-login-program "ssh") |
| 285 | (tramp-login-args (("-l" "%u") ("-p" "%p") | 265 | (tramp-login-args (("-l" "%u") ("-p" "%p") |
| 266 | ,tramp-ssh-controlmaster-template | ||
| 286 | ("-2") ("-e" "none") ("%h"))) | 267 | ("-2") ("-e" "none") ("%h"))) |
| 287 | (tramp-async-args (("-q"))) | 268 | (tramp-async-args (("-q"))) |
| 288 | (tramp-remote-shell "/bin/sh") | 269 | (tramp-remote-shell "/bin/sh") |
| @@ -293,11 +274,11 @@ detected as prompt when being sent on echoing hosts, therefore.") | |||
| 293 | (tramp-default-port 22))) | 274 | (tramp-default-port 22))) |
| 294 | ;;;###tramp-autoload | 275 | ;;;###tramp-autoload |
| 295 | (add-to-list 'tramp-methods | 276 | (add-to-list 'tramp-methods |
| 296 | '("sshx" | 277 | `("sshx" |
| 297 | (tramp-login-program "ssh") | 278 | (tramp-login-program "ssh") |
| 298 | (tramp-login-args (("-l" "%u") ("-p" "%p") | 279 | (tramp-login-args (("-l" "%u") ("-p" "%p") |
| 299 | ("-e" "none") ("-t" "-t") | 280 | ,tramp-ssh-controlmaster-template |
| 300 | ("%h") ("/bin/sh"))) | 281 | ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh"))) |
| 301 | (tramp-async-args (("-q"))) | 282 | (tramp-async-args (("-q"))) |
| 302 | (tramp-remote-shell "/bin/sh") | 283 | (tramp-remote-shell "/bin/sh") |
| 303 | (tramp-remote-shell-args ("-c")) | 284 | (tramp-remote-shell-args ("-c")) |
| @@ -473,21 +454,14 @@ detected as prompt when being sent on echoing hosts, therefore.") | |||
| 473 | (tramp-set-completion-function "scp" tramp-completion-function-alist-ssh) | 454 | (tramp-set-completion-function "scp" tramp-completion-function-alist-ssh) |
| 474 | (tramp-set-completion-function "scp1" tramp-completion-function-alist-ssh) | 455 | (tramp-set-completion-function "scp1" tramp-completion-function-alist-ssh) |
| 475 | (tramp-set-completion-function "scp2" tramp-completion-function-alist-ssh) | 456 | (tramp-set-completion-function "scp2" tramp-completion-function-alist-ssh) |
| 476 | (tramp-set-completion-function "scpc" tramp-completion-function-alist-ssh) | ||
| 477 | (tramp-set-completion-function "scpx" tramp-completion-function-alist-ssh) | 457 | (tramp-set-completion-function "scpx" tramp-completion-function-alist-ssh) |
| 478 | (tramp-set-completion-function "sftp" tramp-completion-function-alist-ssh) | 458 | (tramp-set-completion-function "sftp" tramp-completion-function-alist-ssh) |
| 479 | (tramp-set-completion-function "rsync" tramp-completion-function-alist-ssh) | 459 | (tramp-set-completion-function "rsync" tramp-completion-function-alist-ssh) |
| 480 | (tramp-set-completion-function | ||
| 481 | "rsyncc" tramp-completion-function-alist-ssh) | ||
| 482 | (tramp-set-completion-function "rsh" tramp-completion-function-alist-rsh) | 460 | (tramp-set-completion-function "rsh" tramp-completion-function-alist-rsh) |
| 483 | (tramp-set-completion-function "remsh" tramp-completion-function-alist-rsh) | 461 | (tramp-set-completion-function "remsh" tramp-completion-function-alist-rsh) |
| 484 | (tramp-set-completion-function "ssh" tramp-completion-function-alist-ssh) | 462 | (tramp-set-completion-function "ssh" tramp-completion-function-alist-ssh) |
| 485 | (tramp-set-completion-function "ssh1" tramp-completion-function-alist-ssh) | 463 | (tramp-set-completion-function "ssh1" tramp-completion-function-alist-ssh) |
| 486 | (tramp-set-completion-function "ssh2" tramp-completion-function-alist-ssh) | 464 | (tramp-set-completion-function "ssh2" tramp-completion-function-alist-ssh) |
| 487 | (tramp-set-completion-function | ||
| 488 | "ssh1_old" tramp-completion-function-alist-ssh) | ||
| 489 | (tramp-set-completion-function | ||
| 490 | "ssh2_old" tramp-completion-function-alist-ssh) | ||
| 491 | (tramp-set-completion-function "sshx" tramp-completion-function-alist-ssh) | 465 | (tramp-set-completion-function "sshx" tramp-completion-function-alist-ssh) |
| 492 | (tramp-set-completion-function | 466 | (tramp-set-completion-function |
| 493 | "telnet" tramp-completion-function-alist-telnet) | 467 | "telnet" tramp-completion-function-alist-telnet) |
| @@ -2419,7 +2393,7 @@ The method used must be an out-of-band method." | |||
| 2419 | v "process-buffer" (current-buffer)) | 2393 | v "process-buffer" (current-buffer)) |
| 2420 | (while copy-env | 2394 | (while copy-env |
| 2421 | (tramp-message | 2395 | (tramp-message |
| 2422 | orig-vec 5 "%s=\"%s\"" (car copy-env) (cadr copy-env)) | 2396 | orig-vec 6 "%s=\"%s\"" (car copy-env) (cadr copy-env)) |
| 2423 | (setenv (pop copy-env) (pop copy-env))) | 2397 | (setenv (pop copy-env) (pop copy-env))) |
| 2424 | 2398 | ||
| 2425 | ;; Use an asynchronous process. By this, password can | 2399 | ;; Use an asynchronous process. By this, password can |
| @@ -4478,14 +4452,16 @@ connection if a previous connection has died for some reason." | |||
| 4478 | ;; temporary file has another name, and it is | 4452 | ;; temporary file has another name, and it is |
| 4479 | ;; created and protected by ssh. It is also | 4453 | ;; created and protected by ssh. It is also |
| 4480 | ;; removed by ssh when the connection is | 4454 | ;; removed by ssh when the connection is |
| 4481 | ;; closed. | 4455 | ;; closed. The temporary file name is cached |
| 4456 | ;; in the main connection process, therefore | ||
| 4457 | ;; we cannot use `tramp-get-connection-process'. | ||
| 4482 | (tmpfile | 4458 | (tmpfile |
| 4483 | (tramp-set-connection-property | 4459 | (with-tramp-connection-property |
| 4484 | p "temp-file" | 4460 | (get-process (tramp-buffer-name vec)) "temp-file" |
| 4485 | (make-temp-name | 4461 | (make-temp-name |
| 4486 | (expand-file-name | 4462 | (expand-file-name |
| 4487 | tramp-temp-name-prefix | 4463 | tramp-temp-name-prefix |
| 4488 | (tramp-compat-temporary-file-directory))))) | 4464 | (tramp-compat-temporary-file-directory))))) |
| 4489 | spec r-shell) | 4465 | spec r-shell) |
| 4490 | 4466 | ||
| 4491 | ;; Add arguments for asynchronous processes. | 4467 | ;; Add arguments for asynchronous processes. |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 7743e10c8d4..a4250f94988 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -280,15 +280,18 @@ started on the local host. You should specify a remote host | |||
| 280 | `localhost' or the name of the local host. Another host name is | 280 | `localhost' or the name of the local host. Another host name is |
| 281 | useful only in combination with `tramp-default-proxies-alist'.") | 281 | useful only in combination with `tramp-default-proxies-alist'.") |
| 282 | 282 | ||
| 283 | (defun tramp-detect-ssh-controlmaster () | 283 | ;;;###tramp-autoload |
| 284 | "Call ssh to detect whether it supports the ControlMaster argument. | 284 | (defvar tramp-ssh-controlmaster-template |
| 285 | This function may return nil when the argument is supported, but | 285 | (ignore-errors |
| 286 | shouldn't return t when it isn't." | 286 | (with-temp-buffer |
| 287 | (ignore-errors | 287 | (call-process "ssh" nil t nil "-o" "ControlMaster") |
| 288 | (with-temp-buffer | 288 | (goto-char (point-min)) |
| 289 | (call-process "ssh" nil t nil "-o" "ControlMaster") | 289 | (when (search-forward-regexp "Missing ControlMaster argument" nil t) |
| 290 | (goto-char (point-min)) | 290 | '("-o" "ControlPath=%t.%%r@%%h:%%p" |
| 291 | (search-forward-regexp "Missing ControlMaster argument" nil t)))) | 291 | "-o" "ControlMaster=auto" |
| 292 | "-o" "ControlPersist=no")))) | ||
| 293 | "Call ssh to detect whether it supports the ControlMaster argument. | ||
| 294 | Return a template to be used in `tramp-methods'.") | ||
| 292 | 295 | ||
| 293 | (defcustom tramp-default-method | 296 | (defcustom tramp-default-method |
| 294 | ;; An external copy method seems to be preferred, because it performs | 297 | ;; An external copy method seems to be preferred, because it performs |
| @@ -297,8 +300,9 @@ shouldn't return t when it isn't." | |||
| 297 | ;; permanent password queries. Either a password agent like | 300 | ;; permanent password queries. Either a password agent like |
| 298 | ;; "ssh-agent" or "Pageant" shall run, or the optional | 301 | ;; "ssh-agent" or "Pageant" shall run, or the optional |
| 299 | ;; password-cache.el or auth-sources.el packages shall be active for | 302 | ;; password-cache.el or auth-sources.el packages shall be active for |
| 300 | ;; password caching. "scpc" is chosen if we detect that the user is | 303 | ;; password caching. If we detect that the user is running OpenSSH |
| 301 | ;; running OpenSSH 4.0 or newer. | 304 | ;; 4.0 or newer, we could reuse the connection, which calls also for |
| 305 | ;; an external method. | ||
| 302 | (cond | 306 | (cond |
| 303 | ;; PuTTY is installed. We don't take it, if it is installed on a | 307 | ;; PuTTY is installed. We don't take it, if it is installed on a |
| 304 | ;; non-windows system, or pscp from the pssh (parallel ssh) package | 308 | ;; non-windows system, or pscp from the pssh (parallel ssh) package |
| @@ -314,16 +318,16 @@ shouldn't return t when it isn't." | |||
| 314 | "plink")) | 318 | "plink")) |
| 315 | ;; There is an ssh installation. | 319 | ;; There is an ssh installation. |
| 316 | ((executable-find "scp") | 320 | ((executable-find "scp") |
| 317 | (cond | 321 | (if (or (fboundp 'password-read) |
| 318 | ((tramp-detect-ssh-controlmaster) "scpc") | 322 | (fboundp 'auth-source-user-or-password) |
| 319 | ((or (fboundp 'password-read) | 323 | (fboundp 'auth-source-search) |
| 320 | (fboundp 'auth-source-user-or-password) | 324 | ;; ssh-agent is running. |
| 321 | (fboundp 'auth-source-search) | 325 | (getenv "SSH_AUTH_SOCK") |
| 322 | ;; ssh-agent is running. | 326 | (getenv "SSH_AGENT_PID") |
| 323 | (getenv "SSH_AUTH_SOCK") | 327 | ;; We could reuse the connection. |
| 324 | (getenv "SSH_AGENT_PID")) | 328 | tramp-ssh-controlmaster-template) |
| 325 | "scp") | 329 | "scp" |
| 326 | (t "ssh"))) | 330 | "ssh")) |
| 327 | ;; Fallback. | 331 | ;; Fallback. |
| 328 | (t "ftp")) | 332 | (t "ftp")) |
| 329 | "Default method to use for transferring files. | 333 | "Default method to use for transferring files. |