comparison lisp/net/tramp.el @ 51968:e4c4c45ea013

Tramp 2.0.36 released. * net/tramp.el (tramp-default-password-end-of-line): Renamed from tramp-password-end-of-line. (tramp-password-end-of-line): New method parameter. (tramp-get-password-end-of-line): Function to access method parameter `tramp-password-end-of-line', or variable `tramp-default-password-end-of-line' (default value). (tramp-methods): Add entries for new parameter tramp-password-end-of-line. (tramp-enter-password): Use new function `tramp-get-password-end-of-line'. (tramp-handle-insert-file-contents): Do not unconditionally inhibit the file operation file-local-copy, only do that when the inhibit-file-name-operation is currently insert-file-contents. This fixes finding remote CVS-controlled files. (It would barf on inserting the CVS/Entries file literally, because the file-local-copy handler wasn't called.) (tramp-handle-shell-command): Support optional third arg ERROR-BUFFER. (tramp-sh-extra-args): Adapt defcustom type to XEmacs. (tramp-initial-commands): New variable. (tramp-process-initial-commands): New function, using the variable. (tramp-open-connection-setup-interactive-shell): Call the new function. (tramp-buffer-name, tramp-debug-buffer-name): Always put the method into the buffer name, never use nil. Reported by Hanak David <dhanak@inf.bme.hu>. (tramp-open-connection-setup-interactive-shell): Erase buffer before sending "stty -onlcr". * net/tramp-vc.el (vc-workfile-unchanged-p): Add comment.
author Kai Großjohann <kgrossjo@eu.uu.net>
date Sun, 20 Jul 2003 19:04:48 +0000
parents 978e262c8f3a
children 695cf19ef79e
comparison
equal deleted inserted replaced
51967:2693b0669cc1 51968:e4c4c45ea013
236 (tramp-login-program "rsh") 236 (tramp-login-program "rsh")
237 (tramp-copy-program "rcp") 237 (tramp-copy-program "rcp")
238 (tramp-remote-sh "/bin/sh") 238 (tramp-remote-sh "/bin/sh")
239 (tramp-login-args nil) 239 (tramp-login-args nil)
240 (tramp-copy-args nil) 240 (tramp-copy-args nil)
241 (tramp-copy-keep-date-arg "-p")) 241 (tramp-copy-keep-date-arg "-p")
242 (tramp-password-end-of-line nil))
242 ("scp" (tramp-connection-function tramp-open-connection-rsh) 243 ("scp" (tramp-connection-function tramp-open-connection-rsh)
243 (tramp-login-program "ssh") 244 (tramp-login-program "ssh")
244 (tramp-copy-program "scp") 245 (tramp-copy-program "scp")
245 (tramp-remote-sh "/bin/sh") 246 (tramp-remote-sh "/bin/sh")
246 (tramp-login-args ("-e" "none")) 247 (tramp-login-args ("-e" "none"))
247 (tramp-copy-args nil) 248 (tramp-copy-args nil)
248 (tramp-copy-keep-date-arg "-p")) 249 (tramp-copy-keep-date-arg "-p")
250 (tramp-password-end-of-line nil))
249 ("scp1" (tramp-connection-function tramp-open-connection-rsh) 251 ("scp1" (tramp-connection-function tramp-open-connection-rsh)
250 (tramp-login-program "ssh") 252 (tramp-login-program "ssh")
251 (tramp-copy-program "scp") 253 (tramp-copy-program "scp")
252 (tramp-remote-sh "/bin/sh") 254 (tramp-remote-sh "/bin/sh")
253 (tramp-login-args ("-1" "-e" "none")) 255 (tramp-login-args ("-1" "-e" "none"))
254 (tramp-copy-args ("-1")) 256 (tramp-copy-args ("-1"))
255 (tramp-copy-keep-date-arg "-p")) 257 (tramp-copy-keep-date-arg "-p")
258 (tramp-password-end-of-line nil))
256 ("scp2" (tramp-connection-function tramp-open-connection-rsh) 259 ("scp2" (tramp-connection-function tramp-open-connection-rsh)
257 (tramp-login-program "ssh") 260 (tramp-login-program "ssh")
258 (tramp-copy-program "scp") 261 (tramp-copy-program "scp")
259 (tramp-remote-sh "/bin/sh") 262 (tramp-remote-sh "/bin/sh")
260 (tramp-login-args ("-2" "-e" "none")) 263 (tramp-login-args ("-2" "-e" "none"))
261 (tramp-copy-args ("-2")) 264 (tramp-copy-args ("-2"))
262 (tramp-copy-keep-date-arg "-p")) 265 (tramp-copy-keep-date-arg "-p")
266 (tramp-password-end-of-line nil))
263 ("scp1_old" 267 ("scp1_old"
264 (tramp-connection-function tramp-open-connection-rsh) 268 (tramp-connection-function tramp-open-connection-rsh)
265 (tramp-login-program "ssh1") 269 (tramp-login-program "ssh1")
266 (tramp-copy-program "scp1") 270 (tramp-copy-program "scp1")
267 (tramp-remote-sh "/bin/sh") 271 (tramp-remote-sh "/bin/sh")
268 (tramp-login-args ("-e" "none")) 272 (tramp-login-args ("-e" "none"))
269 (tramp-copy-args nil) 273 (tramp-copy-args nil)
270 (tramp-copy-keep-date-arg "-p")) 274 (tramp-copy-keep-date-arg "-p")
275 (tramp-password-end-of-line nil))
271 ("scp2_old" 276 ("scp2_old"
272 (tramp-connection-function tramp-open-connection-rsh) 277 (tramp-connection-function tramp-open-connection-rsh)
273 (tramp-login-program "ssh2") 278 (tramp-login-program "ssh2")
274 (tramp-copy-program "scp2") 279 (tramp-copy-program "scp2")
275 (tramp-remote-sh "/bin/sh") 280 (tramp-remote-sh "/bin/sh")
276 (tramp-login-args ("-e" "none")) 281 (tramp-login-args ("-e" "none"))
277 (tramp-copy-args nil) 282 (tramp-copy-args nil)
278 (tramp-copy-keep-date-arg "-p")) 283 (tramp-copy-keep-date-arg "-p")
284 (tramp-password-end-of-line nil))
279 ("rsync" (tramp-connection-function tramp-open-connection-rsh) 285 ("rsync" (tramp-connection-function tramp-open-connection-rsh)
280 (tramp-login-program "ssh") 286 (tramp-login-program "ssh")
281 (tramp-copy-program "rsync") 287 (tramp-copy-program "rsync")
282 (tramp-remote-sh "/bin/sh") 288 (tramp-remote-sh "/bin/sh")
283 (tramp-login-args ("-e" "none")) 289 (tramp-login-args ("-e" "none"))
284 (tramp-copy-args ("-e" "ssh")) 290 (tramp-copy-args ("-e" "ssh"))
285 (tramp-copy-keep-date-arg "-t")) 291 (tramp-copy-keep-date-arg "-t")
292 (tramp-password-end-of-line nil))
286 ("remcp" (tramp-connection-function tramp-open-connection-rsh) 293 ("remcp" (tramp-connection-function tramp-open-connection-rsh)
287 (tramp-login-program "remsh") 294 (tramp-login-program "remsh")
288 (tramp-copy-program "rcp") 295 (tramp-copy-program "rcp")
289 (tramp-remote-sh "/bin/sh") 296 (tramp-remote-sh "/bin/sh")
290 (tramp-login-args nil) 297 (tramp-login-args nil)
291 (tramp-copy-args nil) 298 (tramp-copy-args nil)
292 (tramp-copy-keep-date-arg "-p")) 299 (tramp-copy-keep-date-arg "-p")
300 (tramp-password-end-of-line nil))
293 ("rsh" (tramp-connection-function tramp-open-connection-rsh) 301 ("rsh" (tramp-connection-function tramp-open-connection-rsh)
294 (tramp-login-program "rsh") 302 (tramp-login-program "rsh")
295 (tramp-copy-program nil) 303 (tramp-copy-program nil)
296 (tramp-remote-sh "/bin/sh") 304 (tramp-remote-sh "/bin/sh")
297 (tramp-login-args nil) 305 (tramp-login-args nil)
298 (tramp-copy-args nil) 306 (tramp-copy-args nil)
299 (tramp-copy-keep-date-arg nil)) 307 (tramp-copy-keep-date-arg nil)
308 (tramp-password-end-of-line nil))
300 ("ssh" (tramp-connection-function tramp-open-connection-rsh) 309 ("ssh" (tramp-connection-function tramp-open-connection-rsh)
301 (tramp-login-program "ssh") 310 (tramp-login-program "ssh")
302 (tramp-copy-program nil) 311 (tramp-copy-program nil)
303 (tramp-remote-sh "/bin/sh") 312 (tramp-remote-sh "/bin/sh")
304 (tramp-login-args ("-e" "none")) 313 (tramp-login-args ("-e" "none"))
305 (tramp-copy-args nil) 314 (tramp-copy-args nil)
306 (tramp-copy-keep-date-arg nil)) 315 (tramp-copy-keep-date-arg nil)
316 (tramp-password-end-of-line nil))
307 ("ssh1" (tramp-connection-function tramp-open-connection-rsh) 317 ("ssh1" (tramp-connection-function tramp-open-connection-rsh)
308 (tramp-login-program "ssh") 318 (tramp-login-program "ssh")
309 (tramp-copy-program nil) 319 (tramp-copy-program nil)
310 (tramp-remote-sh "/bin/sh") 320 (tramp-remote-sh "/bin/sh")
311 (tramp-login-args ("-1" "-e" "none")) 321 (tramp-login-args ("-1" "-e" "none"))
312 (tramp-copy-args ("-1")) 322 (tramp-copy-args ("-1"))
313 (tramp-copy-keep-date-arg nil)) 323 (tramp-copy-keep-date-arg nil)
324 (tramp-password-end-of-line nil))
314 ("ssh2" (tramp-connection-function tramp-open-connection-rsh) 325 ("ssh2" (tramp-connection-function tramp-open-connection-rsh)
315 (tramp-login-program "ssh") 326 (tramp-login-program "ssh")
316 (tramp-copy-program nil) 327 (tramp-copy-program nil)
317 (tramp-remote-sh "/bin/sh") 328 (tramp-remote-sh "/bin/sh")
318 (tramp-login-args ("-2" "-e" "none")) 329 (tramp-login-args ("-2" "-e" "none"))
319 (tramp-copy-args ("-2")) 330 (tramp-copy-args ("-2"))
320 (tramp-copy-keep-date-arg nil)) 331 (tramp-copy-keep-date-arg nil)
332 (tramp-password-end-of-line nil))
321 ("ssh1_old" 333 ("ssh1_old"
322 (tramp-connection-function tramp-open-connection-rsh) 334 (tramp-connection-function tramp-open-connection-rsh)
323 (tramp-login-program "ssh1") 335 (tramp-login-program "ssh1")
324 (tramp-copy-program nil) 336 (tramp-copy-program nil)
325 (tramp-remote-sh "/bin/sh") 337 (tramp-remote-sh "/bin/sh")
326 (tramp-login-args ("-e" "none")) 338 (tramp-login-args ("-e" "none"))
327 (tramp-copy-args nil) 339 (tramp-copy-args nil)
328 (tramp-copy-keep-date-arg nil)) 340 (tramp-copy-keep-date-arg nil)
341 (tramp-password-end-of-line nil))
329 ("ssh2_old" 342 ("ssh2_old"
330 (tramp-connection-function tramp-open-connection-rsh) 343 (tramp-connection-function tramp-open-connection-rsh)
331 (tramp-login-program "ssh2") 344 (tramp-login-program "ssh2")
332 (tramp-copy-program nil) 345 (tramp-copy-program nil)
333 (tramp-remote-sh "/bin/sh") 346 (tramp-remote-sh "/bin/sh")
334 (tramp-login-args ("-e" "none")) 347 (tramp-login-args ("-e" "none"))
335 (tramp-copy-args nil) 348 (tramp-copy-args nil)
336 (tramp-copy-keep-date-arg nil)) 349 (tramp-copy-keep-date-arg nil)
350 (tramp-password-end-of-line nil))
337 ("remsh" (tramp-connection-function tramp-open-connection-rsh) 351 ("remsh" (tramp-connection-function tramp-open-connection-rsh)
338 (tramp-login-program "remsh") 352 (tramp-login-program "remsh")
339 (tramp-copy-program nil) 353 (tramp-copy-program nil)
340 (tramp-remote-sh "/bin/sh") 354 (tramp-remote-sh "/bin/sh")
341 (tramp-login-args nil) 355 (tramp-login-args nil)
342 (tramp-copy-args nil) 356 (tramp-copy-args nil)
343 (tramp-copy-keep-date-arg nil)) 357 (tramp-copy-keep-date-arg nil)
358 (tramp-password-end-of-line nil))
344 ("telnet" 359 ("telnet"
345 (tramp-connection-function tramp-open-connection-telnet) 360 (tramp-connection-function tramp-open-connection-telnet)
346 (tramp-login-program "telnet") 361 (tramp-login-program "telnet")
347 (tramp-copy-program nil) 362 (tramp-copy-program nil)
348 (tramp-remote-sh "/bin/sh") 363 (tramp-remote-sh "/bin/sh")
349 (tramp-login-args nil) 364 (tramp-login-args nil)
350 (tramp-copy-args nil) 365 (tramp-copy-args nil)
351 (tramp-copy-keep-date-arg nil)) 366 (tramp-copy-keep-date-arg nil)
367 (tramp-password-end-of-line nil))
352 ("su" (tramp-connection-function tramp-open-connection-su) 368 ("su" (tramp-connection-function tramp-open-connection-su)
353 (tramp-login-program "su") 369 (tramp-login-program "su")
354 (tramp-copy-program nil) 370 (tramp-copy-program nil)
355 (tramp-remote-sh "/bin/sh") 371 (tramp-remote-sh "/bin/sh")
356 (tramp-login-args ("-" "%u")) 372 (tramp-login-args ("-" "%u"))
357 (tramp-copy-args nil) 373 (tramp-copy-args nil)
358 (tramp-copy-keep-date-arg nil)) 374 (tramp-copy-keep-date-arg nil)
375 (tramp-password-end-of-line nil))
359 ("sudo" (tramp-connection-function tramp-open-connection-su) 376 ("sudo" (tramp-connection-function tramp-open-connection-su)
360 (tramp-login-program "sudo") 377 (tramp-login-program "sudo")
361 (tramp-copy-program nil) 378 (tramp-copy-program nil)
362 (tramp-remote-sh "/bin/sh") 379 (tramp-remote-sh "/bin/sh")
363 (tramp-login-args ("-u" "%u" "-s" 380 (tramp-login-args ("-u" "%u" "-s"
364 "-p" "Password:")) 381 "-p" "Password:"))
365 (tramp-copy-args nil) 382 (tramp-copy-args nil)
366 (tramp-copy-keep-date-arg nil)) 383 (tramp-copy-keep-date-arg nil)
384 (tramp-password-end-of-line nil))
367 ("multi" (tramp-connection-function tramp-open-connection-multi) 385 ("multi" (tramp-connection-function tramp-open-connection-multi)
368 (tramp-login-program nil) 386 (tramp-login-program nil)
369 (tramp-copy-program nil) 387 (tramp-copy-program nil)
370 (tramp-remote-sh "/bin/sh") 388 (tramp-remote-sh "/bin/sh")
371 (tramp-login-args nil) 389 (tramp-login-args nil)
372 (tramp-copy-args nil) 390 (tramp-copy-args nil)
373 (tramp-copy-keep-date-arg nil)) 391 (tramp-copy-keep-date-arg nil)
392 (tramp-password-end-of-line nil))
374 ("scpx" (tramp-connection-function tramp-open-connection-rsh) 393 ("scpx" (tramp-connection-function tramp-open-connection-rsh)
375 (tramp-login-program "ssh") 394 (tramp-login-program "ssh")
376 (tramp-copy-program "scp") 395 (tramp-copy-program "scp")
377 (tramp-remote-sh "/bin/sh") 396 (tramp-remote-sh "/bin/sh")
378 (tramp-login-args ("-e" "none" "-t" "-t" "/bin/sh")) 397 (tramp-login-args ("-e" "none" "-t" "-t" "/bin/sh"))
379 (tramp-copy-args nil) 398 (tramp-copy-args nil)
380 (tramp-copy-keep-date-arg "-p")) 399 (tramp-copy-keep-date-arg "-p")
400 (tramp-password-end-of-line nil))
381 ("sshx" (tramp-connection-function tramp-open-connection-rsh) 401 ("sshx" (tramp-connection-function tramp-open-connection-rsh)
382 (tramp-login-program "ssh") 402 (tramp-login-program "ssh")
383 (tramp-copy-program nil) 403 (tramp-copy-program nil)
384 (tramp-remote-sh "/bin/sh") 404 (tramp-remote-sh "/bin/sh")
385 (tramp-login-args ("-e" "none" "-t" "-t" "/bin/sh")) 405 (tramp-login-args ("-e" "none" "-t" "-t" "/bin/sh"))
386 (tramp-copy-args nil) 406 (tramp-copy-args nil)
387 (tramp-copy-keep-date-arg nil)) 407 (tramp-copy-keep-date-arg nil)
408 (tramp-password-end-of-line nil))
388 ("krlogin" 409 ("krlogin"
389 (tramp-connection-function tramp-open-connection-rsh) 410 (tramp-connection-function tramp-open-connection-rsh)
390 (tramp-login-program "krlogin") 411 (tramp-login-program "krlogin")
391 (tramp-copy-program nil) 412 (tramp-copy-program nil)
392 (tramp-remote-sh "/bin/sh") 413 (tramp-remote-sh "/bin/sh")
393 (tramp-login-args ("-x")) 414 (tramp-login-args ("-x"))
394 (tramp-copy-args nil) 415 (tramp-copy-args nil)
395 (tramp-copy-keep-date-arg nil)) 416 (tramp-copy-keep-date-arg nil)
417 (tramp-password-end-of-line nil))
396 ("plink" 418 ("plink"
397 (tramp-connection-function tramp-open-connection-rsh) 419 (tramp-connection-function tramp-open-connection-rsh)
398 (tramp-login-program "plink") 420 (tramp-login-program "plink")
399 (tramp-copy-program nil) 421 (tramp-copy-program nil)
400 (tramp-remote-sh "/bin/sh") 422 (tramp-remote-sh "/bin/sh")
401 (tramp-login-args ("-ssh")) ;optionally add "-v" 423 (tramp-login-args ("-ssh")) ;optionally add "-v"
402 (tramp-copy-args nil) 424 (tramp-copy-args nil)
403 (tramp-copy-keep-date-arg nil)) 425 (tramp-copy-keep-date-arg nil)
426 (tramp-password-end-of-line "xy")) ;see docstring for "xy"
404 ("plink1" 427 ("plink1"
405 (tramp-connection-function tramp-open-connection-rsh) 428 (tramp-connection-function tramp-open-connection-rsh)
406 (tramp-login-program "plink") 429 (tramp-login-program "plink")
407 (tramp-copy-program nil) 430 (tramp-copy-program nil)
408 (tramp-remote-sh "/bin/sh") 431 (tramp-remote-sh "/bin/sh")
409 (tramp-login-args ("-1" "-ssh")) ;optionally add "-v" 432 (tramp-login-args ("-1" "-ssh")) ;optionally add "-v"
410 (tramp-copy-args nil) 433 (tramp-copy-args nil)
411 (tramp-copy-keep-date-arg nil)) 434 (tramp-copy-keep-date-arg nil)
435 (tramp-password-end-of-line "xy")) ;see docstring for "xy"
412 ("pscp" 436 ("pscp"
413 (tramp-connection-function tramp-open-connection-rsh) 437 (tramp-connection-function tramp-open-connection-rsh)
414 (tramp-login-program "plink") 438 (tramp-login-program "plink")
415 (tramp-copy-program "pscp") 439 (tramp-copy-program "pscp")
416 (tramp-remote-sh "/bin/sh") 440 (tramp-remote-sh "/bin/sh")
417 (tramp-login-args ("-ssh")) 441 (tramp-login-args ("-ssh"))
418 (tramp-copy-args nil) 442 (tramp-copy-args nil)
419 (tramp-copy-keep-date-arg "-p")) 443 (tramp-copy-keep-date-arg "-p")
444 (tramp-password-end-of-line "xy")) ;see docstring for "xy"
420 ("fcp" 445 ("fcp"
421 (tramp-connection-function tramp-open-connection-rsh) 446 (tramp-connection-function tramp-open-connection-rsh)
422 (tramp-login-program "fsh") 447 (tramp-login-program "fsh")
423 (tramp-copy-program "fcp") 448 (tramp-copy-program "fcp")
424 (tramp-remote-sh "/bin/sh -i") 449 (tramp-remote-sh "/bin/sh -i")
425 (tramp-login-args ("sh" "-i")) 450 (tramp-login-args ("sh" "-i"))
426 (tramp-copy-args nil) 451 (tramp-copy-args nil)
427 (tramp-copy-keep-date-arg "-p")) 452 (tramp-copy-keep-date-arg "-p")
453 (tramp-password-end-of-line nil))
428 ) 454 )
429 "*Alist of methods for remote files. 455 "*Alist of methods for remote files.
430 This is a list of entries of the form (NAME PARAM1 PARAM2 ...). 456 This is a list of entries of the form (NAME PARAM1 PARAM2 ...).
431 Each NAME stands for a remote access method. Each PARAM is a 457 Each NAME stands for a remote access method. Each PARAM is a
432 pair of the form (KEY VALUE). The following KEYs are defined: 458 pair of the form (KEY VALUE). The following KEYs are defined:
467 program, the hints for `tramp-login-args' also apply here. 493 program, the hints for `tramp-login-args' also apply here.
468 * `tramp-copy-keep-date-arg' 494 * `tramp-copy-keep-date-arg'
469 This specifies the parameter to use for the copying program when the 495 This specifies the parameter to use for the copying program when the
470 timestamp of the original file should be kept. For `rcp', use `-p', for 496 timestamp of the original file should be kept. For `rcp', use `-p', for
471 `rsync', use `-t'. 497 `rsync', use `-t'.
498 * `tramp-password-end-of-line'
499 This specifies the string to use for terminating the line after
500 submitting the password. If this method parameter is nil, then the
501 value of the normal variable `tramp-default-password-end-of-line'
502 is used. This parameter is necessary because the \"plink\" program
503 requires any two characters after sending the password. These do
504 not have to be newline or carriage return characters. Other login
505 programs are happy with just one character, the newline character.
506 We use \"xy\" as the value for methods using \"plink\".
472 507
473 What does all this mean? Well, you should specify `tramp-login-program' 508 What does all this mean? Well, you should specify `tramp-login-program'
474 for all methods; this program is used to log in to the remote site. Then, 509 for all methods; this program is used to log in to the remote site. Then,
475 there are two ways to actually transfer the files between the local and the 510 there are two ways to actually transfer the files between the local and the
476 remote side. One way is using an additional rcp-like program. If you want 511 remote side. One way is using an additional rcp-like program. If you want
516 (list (const tramp-decoding-command) 551 (list (const tramp-decoding-command)
517 (choice (const nil) string)) 552 (choice (const nil) string))
518 (list (const tramp-encoding-function) 553 (list (const tramp-encoding-function)
519 (choice (const nil) function)) 554 (choice (const nil) function))
520 (list (const tramp-decoding-function) 555 (list (const tramp-decoding-function)
521 (choice (const nil) function)))))) 556 (choice (const nil) function))
557 (list (const tramp-password-end-of-line)
558 (choice (const nil) string))))))
522 559
523 (defcustom tramp-multi-methods '("multi" "multiu") 560 (defcustom tramp-multi-methods '("multi" "multiu")
524 "*List of multi-hop methods. 561 "*List of multi-hop methods.
525 Each entry in this list should be a method name as mentioned in the 562 Each entry in this list should be a method name as mentioned in the
526 variable `tramp-methods'." 563 variable `tramp-methods'."
662 699
663 (defcustom tramp-rsh-end-of-line "\n" 700 (defcustom tramp-rsh-end-of-line "\n"
664 "*String used for end of line in rsh connections. 701 "*String used for end of line in rsh connections.
665 I don't think this ever needs to be changed, so please tell me about it 702 I don't think this ever needs to be changed, so please tell me about it
666 if you need to change this. 703 if you need to change this.
667 Also see `tramp-password-end-of-line'." 704 Also see the method parameter `tramp-password-end-of-line' and the normal
705 variable `tramp-default-password-end-of-line'."
668 :group 'tramp 706 :group 'tramp
669 :type 'string) 707 :type 'string)
670 708
671 (defcustom tramp-password-end-of-line 709 (defcustom tramp-default-password-end-of-line
672 (if (string-match "plink" tramp-default-method) 710 tramp-rsh-end-of-line
673 ;; Any two characters will do for plink! Doesn't have to be
674 ;; newline characters.
675 "xy"
676 tramp-rsh-end-of-line)
677 "*String used for end of line after sending a password. 711 "*String used for end of line after sending a password.
712 This variable provides the default value for the method parameter
713 `tramp-password-end-of-line', see `tramp-methods' for more details.
714
678 It seems that people using plink under Windows need to send 715 It seems that people using plink under Windows need to send
679 \"\\r\\n\" (carriage-return, then newline) after a password, but just 716 \"\\r\\n\" (carriage-return, then newline) after a password, but just
680 \"\\n\" after all other lines. This variable can be used for the 717 \"\\n\" after all other lines. This variable can be used for the
681 password, see `tramp-rsh-end-of-line' for the other cases. 718 password, see `tramp-rsh-end-of-line' for the other cases.
682 719
804 841
805 This variable is only used when Tramp needs to start up another shell 842 This variable is only used when Tramp needs to start up another shell
806 for tilde expansion. The extra arguments should typically prevent the 843 for tilde expansion. The extra arguments should typically prevent the
807 shell from reading its init file." 844 shell from reading its init file."
808 :group 'tramp 845 :group 'tramp
809 :type '(alist :key-type string :value-type string)) 846 ;; This might be the wrong way to test whether the widget type
847 ;; `alist' is available. Who knows the right way to test it?
848 :type (if (get 'alist 'widget-type)
849 '(alist :key-type string :value-type string)
850 '(repeat (cons string string))))
810 851
811 (defcustom tramp-prefix-format 852 (defcustom tramp-prefix-format
812 (if tramp-unified-filenames "/" "/[") 853 (if tramp-unified-filenames "/" "/[")
813 "*String matching the very beginning of tramp file names. 854 "*String matching the very beginning of tramp file names.
814 Used in `tramp-make-tramp-file-name' and `tramp-make-tramp-multi-file-name'." 855 Used in `tramp-make-tramp-file-name' and `tramp-make-tramp-multi-file-name'."
1168 "List of pattern/action pairs. 1209 "List of pattern/action pairs.
1169 This list is used for each hop in multi-hop connections. 1210 This list is used for each hop in multi-hop connections.
1170 See `tramp-actions-before-shell' for more info." 1211 See `tramp-actions-before-shell' for more info."
1171 :group 'tramp 1212 :group 'tramp
1172 :type '(repeat (list variable function))) 1213 :type '(repeat (list variable function)))
1214
1215 (defcustom tramp-initial-commands
1216 '("unset correct"
1217 "unset autocorrect")
1218 "List of commands to send to the first remote shell that we see.
1219 These commands will be sent to any shell, and thus they should be
1220 designed to work in such circumstances. Also, restrict the commands
1221 to the bare necessity for getting the remote shell into a state
1222 where it is possible to execute the Bourne-ish shell.
1223
1224 At the moment, the command to execute the Bourne-ish shell uses strange
1225 quoting which `tcsh' tries to correct, so we send the command \"unset
1226 autocorrect\" to the remote host."
1227 :group 'tramp
1228 :type '(repeat string))
1173 1229
1174 ;; Chunked sending kluge. We set this to 500 for black-listed constellations 1230 ;; Chunked sending kluge. We set this to 500 for black-listed constellations
1175 ;; known to have a bug in `process-send-string'; some ssh connections appear 1231 ;; known to have a bug in `process-send-string'; some ssh connections appear
1176 ;; to drop bytes when data is sent too quickly. 1232 ;; to drop bytes when data is sent too quickly.
1177 (defcustom tramp-chunksize 1233 (defcustom tramp-chunksize
1284 "This internal variable holds a parameter for `tramp-methods'. 1340 "This internal variable holds a parameter for `tramp-methods'.
1285 In the connection buffer, this variable has the value of the like-named 1341 In the connection buffer, this variable has the value of the like-named
1286 method parameter, as specified in `tramp-methods' (which see).") 1342 method parameter, as specified in `tramp-methods' (which see).")
1287 1343
1288 (defvar tramp-decoding-function nil 1344 (defvar tramp-decoding-function nil
1345 "This internal variable holds a parameter for `tramp-methods'.
1346 In the connection buffer, this variable has the value of the like-named
1347 method parameter, as specified in `tramp-methods' (which see).")
1348
1349 (defvar tramp-password-end-of-line nil
1289 "This internal variable holds a parameter for `tramp-methods'. 1350 "This internal variable holds a parameter for `tramp-methods'.
1290 In the connection buffer, this variable has the value of the like-named 1351 In the connection buffer, this variable has the value of the like-named
1291 method parameter, as specified in `tramp-methods' (which see).") 1352 method parameter, as specified in `tramp-methods' (which see).")
1292 1353
1293 ;; CCC `local in each buffer'? 1354 ;; CCC `local in each buffer'?
2894 (if (tramp-tramp-file-p default-directory) 2955 (if (tramp-tramp-file-p default-directory)
2895 (with-parsed-tramp-file-name default-directory nil 2956 (with-parsed-tramp-file-name default-directory nil
2896 (let (status) 2957 (let (status)
2897 (when (string-match "&[ \t]*\\'" command) 2958 (when (string-match "&[ \t]*\\'" command)
2898 (error "Tramp doesn't grok asynchronous shell commands, yet")) 2959 (error "Tramp doesn't grok asynchronous shell commands, yet"))
2899 (when error-buffer 2960 ;; (when error-buffer
2900 (error "Tramp doesn't grok optional third arg ERROR-BUFFER, yet")) 2961 ;; (error "Tramp doesn't grok optional third arg ERROR-BUFFER, yet"))
2901 (save-excursion 2962 (save-excursion
2902 (tramp-barf-unless-okay 2963 (tramp-barf-unless-okay
2903 multi-method method user host 2964 multi-method method user host
2904 (format "cd %s" (tramp-shell-quote-argument localname)) 2965 (format "cd %s" (tramp-shell-quote-argument localname))
2905 nil 'file-error 2966 nil 'file-error
2906 "tramp-handle-shell-command: Couldn't `cd %s'" 2967 "tramp-handle-shell-command: Couldn't `cd %s'"
2907 (tramp-shell-quote-argument localname)) 2968 (tramp-shell-quote-argument localname))
2908 (tramp-send-command multi-method method user host 2969 (tramp-send-command
2909 (concat command "; tramp_old_status=$?")) 2970 multi-method method user host
2971 (if error-buffer
2972 (format "( %s ) 2>/tmp/tramp.$$.err; tramp_old_status=$?"
2973 command)
2974 (format "%s ;tramp_old_status=$?" command)))
2910 ;; This will break if the shell command prints "/////" 2975 ;; This will break if the shell command prints "/////"
2911 ;; somewhere. Let's just hope for the best... 2976 ;; somewhere. Let's just hope for the best...
2912 (tramp-wait-for-output)) 2977 (tramp-wait-for-output))
2913 (unless output-buffer 2978 (unless output-buffer
2914 (setq output-buffer (get-buffer-create "*Shell Command Output*")) 2979 (setq output-buffer (get-buffer-create "*Shell Command Output*"))
2916 (erase-buffer)) 2981 (erase-buffer))
2917 (unless (bufferp output-buffer) 2982 (unless (bufferp output-buffer)
2918 (setq output-buffer (current-buffer))) 2983 (setq output-buffer (current-buffer)))
2919 (set-buffer output-buffer) 2984 (set-buffer output-buffer)
2920 (insert-buffer (tramp-get-buffer multi-method method user host)) 2985 (insert-buffer (tramp-get-buffer multi-method method user host))
2986 (when error-buffer
2987 (save-excursion
2988 (unless (bufferp error-buffer)
2989 (setq error-buffer (get-buffer-create error-buffer)))
2990 (tramp-send-command
2991 multi-method method user host
2992 "cat /tmp/tramp.$$.err")
2993 (tramp-wait-for-output)
2994 (set-buffer error-buffer)
2995 (insert-buffer (tramp-get-buffer multi-method method user host))
2996 (tramp-send-command-and-check
2997 multi-method method user host "rm -f /tmp/tramp.$$.err")))
2921 (save-excursion 2998 (save-excursion
2922 (tramp-send-command multi-method method user host "cd") 2999 (tramp-send-command multi-method method user host "cd")
2923 (tramp-wait-for-output) 3000 (tramp-wait-for-output)
2924 (tramp-send-command 3001 (tramp-send-command
2925 multi-method method user host 3002 multi-method method user host
3082 (list (expand-file-name filename) 0)) 3159 (list (expand-file-name filename) 0))
3083 ;; `insert-file-contents-literally' takes care to avoid calling 3160 ;; `insert-file-contents-literally' takes care to avoid calling
3084 ;; jka-compr. By let-binding inhibit-file-name-operation, we 3161 ;; jka-compr. By let-binding inhibit-file-name-operation, we
3085 ;; propagate that care to the file-local-copy operation. 3162 ;; propagate that care to the file-local-copy operation.
3086 (let ((local-copy 3163 (let ((local-copy
3087 (let ((inhibit-file-name-operation 'file-local-copy)) 3164 (let ((inhibit-file-name-operation
3165 (when (eq inhibit-file-name-operation
3166 'insert-file-contents)
3167 'file-local-copy)))
3088 (file-local-copy filename))) 3168 (file-local-copy filename)))
3089 (coding-system-used nil) 3169 (coding-system-used nil)
3090 (result nil)) 3170 (result nil))
3091 (when visit 3171 (when visit
3092 (setq buffer-file-name filename) 3172 (setq buffer-file-name filename)
4113 (or switch "") 4193 (or switch "")
4114 (tramp-shell-quote-argument localname2)))))) 4194 (tramp-shell-quote-argument localname2))))))
4115 4195
4116 (defun tramp-buffer-name (multi-method method user host) 4196 (defun tramp-buffer-name (multi-method method user host)
4117 "A name for the connection buffer for USER at HOST using METHOD." 4197 "A name for the connection buffer for USER at HOST using METHOD."
4118 (cond (multi-method 4198 (if multi-method
4119 (tramp-buffer-name-multi-method "tramp" multi-method method user host)) 4199 (tramp-buffer-name-multi-method "tramp" multi-method method user host)
4120 (user 4200 (let ((method (tramp-find-method multi-method method user host)))
4121 (format "*tramp/%s %s@%s*" method user host)) 4201 (if user
4122 (t 4202 (format "*tramp/%s %s@%s*" method user host))
4123 (format "*tramp/%s %s*" method host)))) 4203 (format "*tramp/%s %s*" method host))))
4124 4204
4125 (defun tramp-buffer-name-multi-method (prefix multi-method method user host) 4205 (defun tramp-buffer-name-multi-method (prefix multi-method method user host)
4126 "A name for the multi method connection buffer. 4206 "A name for the multi method connection buffer.
4127 MULTI-METHOD gives the multi method, METHOD the array of methods, 4207 MULTI-METHOD gives the multi method, METHOD the array of methods,
4128 USER the array of user names, HOST the array of host names." 4208 USER the array of user names, HOST the array of host names."
4148 "Get the connection buffer to be used for USER at HOST using METHOD." 4228 "Get the connection buffer to be used for USER at HOST using METHOD."
4149 (get-buffer-create (tramp-buffer-name multi-method method user host))) 4229 (get-buffer-create (tramp-buffer-name multi-method method user host)))
4150 4230
4151 (defun tramp-debug-buffer-name (multi-method method user host) 4231 (defun tramp-debug-buffer-name (multi-method method user host)
4152 "A name for the debug buffer for USER at HOST using METHOD." 4232 "A name for the debug buffer for USER at HOST using METHOD."
4153 (cond (multi-method 4233 (if multi-method
4154 (tramp-buffer-name-multi-method "debug tramp" 4234 (tramp-buffer-name-multi-method "debug tramp"
4155 multi-method method user host)) 4235 multi-method method user host)
4156 (user 4236 (let ((method (tramp-find-method multi-method method user host)))
4157 (format "*debug tramp/%s %s@%s*" method user host)) 4237 (if user
4158 (t 4238 (format "*debug tramp/%s %s@%s*" method user host)
4159 (format "*debug tramp/%s %s*" method host)))) 4239 (format "*debug tramp/%s %s*" method host)))))
4160 4240
4161 (defun tramp-get-debug-buffer (multi-method method user host) 4241 (defun tramp-get-debug-buffer (multi-method method user host)
4162 "Get the debug buffer for USER at HOST using METHOD." 4242 "Get the debug buffer for USER at HOST using METHOD."
4163 (get-buffer-create (tramp-debug-buffer-name multi-method method user host))) 4243 (get-buffer-create (tramp-debug-buffer-name multi-method method user host)))
4164 4244
4537 (catch 'tramp-action 4617 (catch 'tramp-action
4538 (tramp-process-one-multi-action p method user host actions) 4618 (tramp-process-one-multi-action p method user host actions)
4539 nil))) 4619 nil)))
4540 (unless (eq exit 'ok) 4620 (unless (eq exit 'ok)
4541 (error "Login failed")))) 4621 (error "Login failed"))))
4622
4623 ;; Functions to execute when we have seen the remote shell prompt but
4624 ;; before we exec the Bourne-ish shell. Note that these commands
4625 ;; might be sent to any shell, not just a Bourne-ish shell. This
4626 ;; means that the commands need to work in all shells. (It is also
4627 ;; okay for some commands to just fail with an error message, but
4628 ;; please make sure that they at least don't crash the odd shell people
4629 ;; might be running...)
4630 (defun tramp-process-initial-commands (p
4631 multi-method method user host
4632 commands)
4633 "Send list of commands to remote host, in order."
4634 (let (cmd)
4635 (while commands
4636 (setq cmd (pop commands))
4637 (erase-buffer)
4638 (tramp-message 10 "Sending command to remote shell: %s"
4639 cmd)
4640 (tramp-send-command multi-method method user host cmd)
4641 (tramp-barf-if-no-shell-prompt
4642 p 60 "Remote shell command failed: %s" cmd))
4643 (erase-buffer)))
4542 4644
4543 ;; The actual functions for opening connections. 4645 ;; The actual functions for opening connections.
4544 4646
4545 (defun tramp-open-connection-telnet (multi-method method user host) 4647 (defun tramp-open-connection-telnet (multi-method method user host)
4546 "Open a connection using a telnet METHOD. 4648 "Open a connection using a telnet METHOD.
4948 (defun tramp-enter-password (p prompt) 5050 (defun tramp-enter-password (p prompt)
4949 "Prompt for a password and send it to the remote end. 5051 "Prompt for a password and send it to the remote end.
4950 Uses PROMPT as a prompt and sends the password to process P." 5052 Uses PROMPT as a prompt and sends the password to process P."
4951 (let ((pw (tramp-read-passwd prompt))) 5053 (let ((pw (tramp-read-passwd prompt)))
4952 (erase-buffer) 5054 (erase-buffer)
4953 (process-send-string p (concat pw tramp-password-end-of-line)))) 5055 (process-send-string
5056 p (concat pw
5057 (tramp-get-password-end-of-line
5058 tramp-current-multi-method
5059 tramp-current-method
5060 tramp-current-user
5061 tramp-current-host)))))
4954 5062
4955 ;; HHH: Not Changed. This might handle the case where USER is not 5063 ;; HHH: Not Changed. This might handle the case where USER is not
4956 ;; given in the "File name" very poorly. Then, the local 5064 ;; given in the "File name" very poorly. Then, the local
4957 ;; variable tramp-current user will be set to nil. 5065 ;; variable tramp-current user will be set to nil.
4958 (defun tramp-pre-connection (multi-method method user host) 5066 (defun tramp-pre-connection (multi-method method user host)
4974 ;; Wait a bit in case the remote end feels like sending a little 5082 ;; Wait a bit in case the remote end feels like sending a little
4975 ;; junk first. It seems that fencepost.gnu.org does this when doing 5083 ;; junk first. It seems that fencepost.gnu.org does this when doing
4976 ;; a Kerberos login. 5084 ;; a Kerberos login.
4977 (sit-for 1) 5085 (sit-for 1)
4978 (tramp-discard-garbage-erase-buffer p multi-method method user host) 5086 (tramp-discard-garbage-erase-buffer p multi-method method user host)
5087 (tramp-process-initial-commands p multi-method method user host
5088 tramp-initial-commands)
4979 ;; It is useful to set the prompt in the following command because 5089 ;; It is useful to set the prompt in the following command because
4980 ;; some people have a setting for $PS1 which /bin/sh doesn't know 5090 ;; some people have a setting for $PS1 which /bin/sh doesn't know
4981 ;; about and thus /bin/sh will display a strange prompt. For 5091 ;; about and thus /bin/sh will display a strange prompt. For
4982 ;; example, if $PS1 has "${CWD}" in the value, then ksh will display 5092 ;; example, if $PS1 has "${CWD}" in the value, then ksh will display
4983 ;; the current working directory but /bin/sh will display a dollar 5093 ;; the current working directory but /bin/sh will display a dollar
5033 ;; Look for ^M and do something useful if found. 5143 ;; Look for ^M and do something useful if found.
5034 (when (search-forward "\r" nil t) 5144 (when (search-forward "\r" nil t)
5035 ;; We have found a ^M but cannot frob the process coding system 5145 ;; We have found a ^M but cannot frob the process coding system
5036 ;; because we're running on a non-MULE Emacs. Let's try 5146 ;; because we're running on a non-MULE Emacs. Let's try
5037 ;; stty, instead. 5147 ;; stty, instead.
5148 (erase-buffer)
5038 (tramp-message 9 "Trying `stty -onlcr'") 5149 (tramp-message 9 "Trying `stty -onlcr'")
5039 (tramp-send-command-internal multi-method method user host 5150 (tramp-send-command-internal multi-method method user host
5040 "stty -onlcr")))) 5151 "stty -onlcr"))))
5041 (erase-buffer) 5152 (erase-buffer)
5042 (tramp-message 5153 (tramp-message
6055 (assoc (tramp-find-method multi-method method user host) 6166 (assoc (tramp-find-method multi-method method user host)
6056 tramp-methods)) 6167 tramp-methods))
6057 (error "Method `%s' didn't specify `keep-date' arg for tramp" 6168 (error "Method `%s' didn't specify `keep-date' arg for tramp"
6058 (or multi-method method))))) 6169 (or multi-method method)))))
6059 6170
6171 (defun tramp-get-password-end-of-line (multi-method method user host)
6172 (let ((entry (assoc 'tramp-password-end-of-line
6173 (assoc (tramp-find-method multi-method method user host)
6174 tramp-methods))))
6175 (unless entry
6176 (error "Method `%s' didn't specify `password-end-of-line' arg for tramp"
6177 (or multi-method method)))
6178 (or (second entry) tramp-default-password-end-of-line)))
6179
6060 ;; Auto saving to a special directory. 6180 ;; Auto saving to a special directory.
6061 6181
6062 (defun tramp-make-auto-save-file-name (fn) 6182 (defun tramp-make-auto-save-file-name (fn)
6063 "Returns a file name in `tramp-auto-save-directory' for autosaving this file." 6183 "Returns a file name in `tramp-auto-save-directory' for autosaving this file."
6064 (when tramp-auto-save-directory 6184 (when tramp-auto-save-directory
6320 6440
6321 ;; System defaults 6441 ;; System defaults
6322 tramp-auto-save-directory ; vars to dump 6442 tramp-auto-save-directory ; vars to dump
6323 tramp-default-method 6443 tramp-default-method
6324 tramp-rsh-end-of-line 6444 tramp-rsh-end-of-line
6325 tramp-password-end-of-line 6445 tramp-default-password-end-of-line
6326 tramp-remote-path 6446 tramp-remote-path
6327 tramp-login-prompt-regexp 6447 tramp-login-prompt-regexp
6328 tramp-password-prompt-regexp 6448 tramp-password-prompt-regexp
6329 tramp-wrong-passwd-regexp 6449 tramp-wrong-passwd-regexp
6330 tramp-yesno-prompt-regexp 6450 tramp-yesno-prompt-regexp