From 8fbcce2d5a7bfa1a9bf4648408d688d175b1a4ee Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 28 Jul 2010 12:02:18 +0200 Subject: [PATCH] * net/tramp.el (tramp-methods): Move hostname to the end in all ssh `tramp-login-args'. (tramp-verbose): Describe verbose level 9. (tramp-open-shell): Check for tty if `tramp-verbose' >= 9. (tramp-open-connection-setup-interactive-shell): Trace stty settings if `tramp-verbose' >= 9. (tramp-handle-start-file-process): Implement tty setting. (Bug#4604, Bug#6360) * net/tramp-cmds.el (tramp-bug): Recommend setting of `tramp-verbose' to 9. --- lisp/ChangeLog | 14 +++++++ lisp/net/tramp-cmds.el | 2 +- lisp/net/tramp.el | 88 ++++++++++++++++++++++++------------------ 3 files changed, 66 insertions(+), 38 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c8fb46acf4e..6d329d663ab 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +2010-07-28 Michael Albinus + + * net/tramp.el (tramp-methods): Move hostname to the end in all + ssh `tramp-login-args'. + (tramp-verbose): Describe verbose level 9. + (tramp-open-shell): Check for tty if `tramp-verbose' >= 9. + (tramp-open-connection-setup-interactive-shell): Trace stty + settings if `tramp-verbose' >= 9. + (tramp-handle-start-file-process): Implement tty setting. + (Bug#4604, Bug#6360) + + * net/tramp-cmds.el (tramp-bug): Recommend setting of + `tramp-verbose' to 9. + 2010-07-27 Aaron S. Hawley * emacs-lisp/re-builder.el (reb-re-syntax, reb-lisp-mode) diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 86501561238..0e31360a416 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -225,7 +225,7 @@ Before reproducing the bug, you might apply This allows to investigate from a clean environment. Another useful thing to do is to put - (setq tramp-verbose 8) + (setq tramp-verbose 9) in the ~/.emacs file and to repeat the bug. Then, include the contents of the *tramp/foo* buffer and the *debug tramp/foo* diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 2a4f57e2045..6256c8c631d 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -200,6 +200,7 @@ Any level x includes messages for all levels 1 .. x-1. The levels are 6 sent and received strings 7 file caching 8 connection properties + 9 test commands 10 traces (huge)." :group 'tramp :type 'integer) @@ -332,8 +333,8 @@ detected as prompt when being sent on echoing hosts, therefore.") (tramp-copy-recursive t) (tramp-password-end-of-line nil)) ("scp" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") - ("-e" "none"))) + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-e" "none") ("%h"))) (tramp-async-args (("-q"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program "scp") @@ -348,8 +349,8 @@ detected as prompt when being sent on echoing hosts, therefore.") ("-o" "StrictHostKeyChecking=no"))) (tramp-default-port 22)) ("scp1" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") - ("-1" "-e" "none"))) + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-1") ("-e" "none") ("%h"))) (tramp-async-args (("-q"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program "scp") @@ -364,8 +365,8 @@ detected as prompt when being sent on echoing hosts, therefore.") ("-o" "StrictHostKeyChecking=no"))) (tramp-default-port 22)) ("scp2" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") - ("-2" "-e" "none"))) + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-2") ("-e" "none") ("%h"))) (tramp-async-args (("-q"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program "scp") @@ -400,8 +401,8 @@ detected as prompt when being sent on echoing hosts, therefore.") (tramp-copy-recursive t) (tramp-password-end-of-line nil)) ("sftp" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") - ("-e" "none"))) + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-e" "none") ("%h"))) (tramp-async-args (("-q"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program "sftp") @@ -409,8 +410,8 @@ detected as prompt when being sent on echoing hosts, therefore.") (tramp-copy-keep-date nil) (tramp-password-end-of-line nil)) ("rsync" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") - ("-e" "none"))) + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-e" "none") ("%h"))) (tramp-async-args (("-q"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program "rsync") @@ -421,10 +422,10 @@ detected as prompt when being sent on echoing hosts, therefore.") (tramp-password-end-of-line nil)) ("rsyncc" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") + (tramp-login-args (("-l" "%u") ("-p" "%p") ("-o" "ControlPath=%t.%%r@%%h:%%p") ("-o" "ControlMaster=yes") - ("-e" "none"))) + ("-e" "none") ("%h"))) (tramp-async-args (("-q"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program "rsync") @@ -453,8 +454,8 @@ detected as prompt when being sent on echoing hosts, therefore.") (tramp-copy-keep-date nil) (tramp-password-end-of-line nil)) ("ssh" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") - ("-e" "none"))) + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-e" "none") ("%h"))) (tramp-async-args (("-q"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program nil) @@ -467,8 +468,8 @@ detected as prompt when being sent on echoing hosts, therefore.") ("-o" "StrictHostKeyChecking=no"))) (tramp-default-port 22)) ("ssh1" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") - ("-1" "-e" "none"))) + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-1") ("-e" "none") ("%h"))) (tramp-async-args (("-q"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program nil) @@ -481,8 +482,8 @@ detected as prompt when being sent on echoing hosts, therefore.") ("-o" "StrictHostKeyChecking=no"))) (tramp-default-port 22)) ("ssh2" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") - ("-2" "-e" "none"))) + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-2") ("-e" "none") ("%h"))) (tramp-async-args (("-q"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program nil) @@ -545,10 +546,10 @@ detected as prompt when being sent on echoing hosts, therefore.") (tramp-copy-keep-date nil) (tramp-password-end-of-line nil)) ("scpc" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") + (tramp-login-args (("-l" "%u") ("-p" "%p") ("-o" "ControlPath=%t.%%r@%%h:%%p") ("-o" "ControlMaster=yes") - ("-e" "none"))) + ("-e" "none") ("%h"))) (tramp-async-args (("-q"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program "scp") @@ -563,8 +564,9 @@ detected as prompt when being sent on echoing hosts, therefore.") ("-o" "StrictHostKeyChecking=no"))) (tramp-default-port 22)) ("scpx" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") - ("-e" "none" "-t" "-t" "/bin/sh"))) + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-e" "none") ("-t" "-t") + ("%h") ("/bin/sh"))) (tramp-async-args (("-q"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program "scp") @@ -577,8 +579,9 @@ detected as prompt when being sent on echoing hosts, therefore.") ("-o" "StrictHostKeyChecking=no"))) (tramp-default-port 22)) ("sshx" (tramp-login-program "ssh") - (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") - ("-e" "none" "-t" "-t" "/bin/sh"))) + (tramp-login-args (("-l" "%u") ("-p" "%p") + ("-e" "none") ("-t" "-t") + ("%h") ("/bin/sh"))) (tramp-async-args (("-q"))) (tramp-remote-sh "/bin/sh") (tramp-copy-program nil) @@ -4506,14 +4509,16 @@ beginning of local filename are not substituted." (defun tramp-handle-start-file-process (name buffer program &rest args) "Like `start-file-process' for Tramp files." (with-parsed-tramp-file-name default-directory nil - (unless (stringp program) - (tramp-error - v 'file-error "pty association is not supported for `%s'" name)) (unwind-protect - (let ((command (format "cd %s; exec %s" - (tramp-shell-quote-argument localname) - (mapconcat 'tramp-shell-quote-argument - (cons program args) " "))) + ;; When PROGRAM is nil, we just provide a tty. + (let ((command + (when (stringp program) + (format "cd %s; exec %s" + (tramp-shell-quote-argument localname) + (mapconcat 'tramp-shell-quote-argument + (cons program args) " ")))) + (tramp-process-connection-type + (or (null program) tramp-process-connection-type)) (name1 name) (i 0)) (unless buffer @@ -4533,9 +4538,16 @@ beginning of local filename are not substituted." (with-current-buffer (tramp-get-connection-buffer v) (clear-visited-file-modtime) (narrow-to-region (point-max) (point-max))) - ;; Send the command. `tramp-send-command' opens a new - ;; connection. - (tramp-send-command v command nil t) ; nooutput + (if (stringp program) + ;; Send the command. `tramp-send-command' opens a new + ;; connection. + (tramp-send-command v command nil t) ; nooutput + ;; Check, whether a pty is associated, and set it as + ;; process property. + (condition-case nil + (tramp-send-command-and-read v "echo \\\"`tty`\\\"") + (tramp-error + v 'file-error "pty association is not supported for `%s'" name))) ;; Set query flag for this process. (tramp-set-process-query-on-exit-flag (tramp-get-connection-process v) t) @@ -6619,7 +6631,10 @@ file exists and nonzero exit status otherwise." vec (format "PS1=%s" (shell-quote-argument tramp-end-of-output)) t) (tramp-send-command vec "PS2=''" t) (tramp-send-command vec "PS3=''" t) - (tramp-send-command vec "PROMPT_COMMAND=''" t))) + (tramp-send-command vec "PROMPT_COMMAND=''" t) + ;; Dump tty in the traces. + (when (>= tramp-verbose 9) + (tramp-send-command vec "tty" t)))) (defun tramp-find-shell (vec) "Opens a shell on the remote host which groks tilde expansion." @@ -6984,7 +6999,7 @@ process to set up. VEC specifies the connection." ;; stty, instead. (tramp-send-command vec "stty -onlcr" t)))) ;; Dump stty settings in the traces. - (when (>= tramp-verbose 10) + (when (>= tramp-verbose 9) (tramp-send-command vec "stty -a" t)) (tramp-send-command vec "set +o vi +o emacs" t) @@ -8950,7 +8965,6 @@ Only works for Bourne-like shells." ;; rsync). ;; * Keep a second connection open for out-of-band methods like scp or ;; rsync. -;; * Support ptys in `tramp-handle-start-file-process'. (Bug#4604, Bug#6360) ;; * IMHO, it's a drawback that currently Tramp doesn't support ;; Unicode in Dired file names by default. Is it possible to ;; improve Tramp to set LC_ALL to "C" only for commands where Tramp -- 2.39.2