![为什么在向远程主机发送 Perl 脚本时 Tramp 会挂起?](https://linux22.com/image/488083/%E4%B8%BA%E4%BB%80%E4%B9%88%E5%9C%A8%E5%90%91%E8%BF%9C%E7%A8%8B%E4%B8%BB%E6%9C%BA%E5%8F%91%E9%80%81%20Perl%20%E8%84%9A%E6%9C%AC%E6%97%B6%20Tramp%20%E4%BC%9A%E6%8C%82%E8%B5%B7%EF%BC%9F.png)
我知道这与编程没有直接关系,但是我很困惑,而且因为 Emacs 是我的主要编程工具......
我正在尝试设置 Tramp 以连接到我的测试主机。我使用/ssh:host:.bashrc
或调用它/scp:host:.bashrc
,但这两种方式迟早都会遇到同样的问题。
在进程阻塞之前,他们仅仅尝试第一次发送 perl 脚本,然后我被迫从客户端终止 ssh 会话。
例如:
tramp: Opening connection for username@host using scp...
tramp: Waiting 60s for local shell to come up...
tramp: Sending command `ssh host -l username -e none || exit'
tramp: Waiting for prompts from remote shell
tramp: Waiting 60s for prompt from remote shell on host host
tramp: Found remote shell prompt on `host'
tramp: Waiting 30s for remote `/bin/sh' to come up...
tramp: Setting up remote shell environment
tramp: Determining coding system
tramp: Waiting 30s for `HISTFILE=$HOME/.tramp_history; HISTSIZE=1; export HISTFILE; export HISTSIZE'
tramp: Waiting 30s for `set +o vi +o emacs'
tramp: Waiting 30s for `unset MAIL MAILCHECK MAILPATH'
tramp: Waiting 30s for `unset CDPATH'
tramp: Setting shell prompt
tramp: Remote `/bin/sh' groks tilde expansion, good
tramp: Finding command to check if file exists
tramp: Finding a suitable `ls' command
tramp: Checking remote `/bin/ls' command for `-n' option
tramp: Testing remote command `/bin/ls' for -n...okay
tramp: Using remote command `/bin/ls' for getting directory listings
tramp: Sending the Perl script `tramp_file_attributes'...
tramp-wait-for-output: Process has died
此跟踪正在使用该scp
方法。该ssh
方法如下所示:
tramp: Opening connection for username@host using ssh...
tramp: Waiting 60s for local shell to come up...
tramp: Sending command `ssh host -l username -e none || exit'
tramp: Waiting for prompts from remote shell
tramp: Waiting 60s for prompt from remote shell on host host
tramp: Found remote shell prompt on `host'
tramp: Waiting 30s for remote `/bin/sh' to come up...
tramp: Setting up remote shell environment
tramp: Determining coding system
tramp: Waiting 30s for `HISTFILE=$HOME/.tramp_history; HISTSIZE=1; export HISTFILE; export HISTSIZE'
tramp: Waiting 30s for `set +o vi +o emacs'
tramp: Waiting 30s for `unset MAIL MAILCHECK MAILPATH'
tramp: Waiting 30s for `unset CDPATH'
tramp: Setting shell prompt
tramp: Remote `/bin/sh' groks tilde expansion, good
tramp: Finding command to check if file exists
tramp: Finding a suitable `ls' command
tramp: Checking remote `/bin/ls' command for `-n' option
tramp: Testing remote command `/bin/ls' for -n...okay
tramp: Using remote command `/bin/ls' for getting directory listings
tramp: Sending the Perl `mime-encode' implementations.
tramp-wait-for-output: Process has died
如您所见,最后发生的事情是尝试发送 Perl 脚本。该进程即将终止,因为我正在另一个 shell 中终止它,否则 emacs 永远不会从此恢复。
我从 OSX 10.5.7 进行连接FreeBSD 6.2-RELEASE-p5
,如果有任何区别的话,使用2.0.58-pre
Carbon Emacs 22.3.1 版本中的 Tramp。
答案1
也许在接收端(FreeBSD 服务器)对 sshd 的 pid 进行 strace 会显示它在哪里被锁定。您需要使用 -f 跟踪子进程。如果 sshd 的 pid 是 3125:
sudo strace -vfp 3125 -o sshdStraceDump.txt