unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Help with Emacs 22.2.1 using TRAMP and PuTTY/plink
@ 2008-05-01  6:35 lyallp
  2008-05-04 11:23 ` Michael Albinus
       [not found] ` <mailman.11172.1209900210.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: lyallp @ 2008-05-01  6:35 UTC (permalink / raw)
  To: help-gnu-emacs

Emacs version 22.2.1 (i386-mingw-nt5.1.2600) of 2008-03-27 on RELEASE

running on Windows XP
Connecting to a Solaris Unix host using PuTTY 0.60 plink with a pagent
running with suitable keys loaded.

I have updated windows PATH to include the PuTTY install directory so
Tramp can find it.

plink, by itself will quite happily connect.

I connect, but then it does not find the command line prompt unless I
change 'Tramp rsh end of line' in Customize->Files->Tramp to '\r'

The problem with this is that tramp puts a \r on the end of every
input line, which is not what I want.

Then, when tramp tries to execute
  exec env 'ENV=' 'PROMPT_COMMAND=' 'PS1=$ ' /bin/sh
it tacks a \n on the end, which is interpreted as a character in the /
bin/sh filename, which makes the program /bin/sh<newline> not found,
causing termination of the shell and subsequent termination of plink
and finally process 'exit' within emacs.

If I don't set the  'Tramp rsh end of line', then tramp does not find
the initial login prompt, which is returned (albeit a rather long one
as I update my window title via the prompt string)

I also tried setting it to '\n'

I have tweaked the debug output to show the process info...

Debug output is as follows (with control chars replaced by thier
visible equivilents):-

# Opening connection for user_name@the_host using nil...
# plink the_host -l user_name -ssh
# Waiting for prompts from remote shell
# Waiting 60s for prompt from remote shell
# Looking for regexp "^.*\([pP]assword\|passphrase\).*:^@? *" from
remote shell
# Looking for regexp ".*ogin\( .*\)?: *" from remote shell
# Looking for regexp "^[^#$%>
]*[#$%>] *" from remote shell
# Looking for regexp "^[^#$%>
]*[#$%>] *\(^[\[[0-9;]*[a-zA-Z] *\)*" from remote shell
# Looking for regexp "^.*\(Connection \(?:\(?:clo\|refu\)sed\)\|Host
key verification failed\.\|Login \(?:[Ii]ncorrect\)\|Name or service
not known\|\(?:Permission denied\|Sorry, try again\)\.\).*\|^.*\
(Received signal [0-9]+\).*" from remote shell
# Looking for regexp "\(Are you sure you want to continue connecting
(yes/no)\?\)\s-*" from remote shell
# Looking for regexp "\(\(?:Store key in cache\? (y/\|Update cached key
\? (y/n, Return cancels connectio\)n)\)\s-*" from remote shell
# Looking for regexp "\(TERM = (.*)\|Terminal type\? \[.*\]\)\s-*"
from remote shell
# Looking for regexp "" from remote shell
# Looking for regexp "^.*\([pP]assword\|passphrase\).*:^@? *" from
remote shell
# Looking for regexp ".*ogin\( .*\)?: *" from remote shell
# Looking for regexp "^[^#$%>
]*[#$%>] *" from remote shell
# Found remote shell prompt.
# Initializing remote shell
# Sending command to remote shell: unset HISTORY
$ unset HISTORY
# Process *tramp/plink user_name@the_host*
unset HISTORY\r
>^H^[]2 the_host - user_name - /home/user_name\auser_name@the_host:>^H~^M
$
>^H^[]2 the_host - user_name - /home/user_name\auser_name@the_host:>^H~^M
$
# Sending command to remote shell: unset correct
$ unset correct
# Process *tramp/plink user_name@the_host*
unset correct\r
>^H^[]2 the_host - user_name - /home/user_name\auser_name@the_host:>^H~^M
$
>^H^[]2 the_host - user_name - /home/user_name\auser_name@the_host:>^H~^M
$
# Sending command to remote shell: unset autocorrect
$ unset autocorrect
# Process *tramp/plink user_name@the_host*
unset autocorrect\r
>^H^[]2 the_host - user_name - /home/user_name\auser_name@the_host:>^H~^M
$
>^H^[]2 the_host - user_name - /home/user_name\auser_name@the_host:>^H~^M
$ $ exec env 'ENV=' 'PROMPT_COMMAND=' 'PS1=$ ' /bin/sh #
# Waiting 30s for remote `/bin/sh' to come up...
# Process nil
exec env 'ENV=' 'PROMPT_COMMAND=' 'PS1=$ ' /bin/sh #\r
$ $ [[Regexp `\(^[^#$%>
]*[#$%>] *\|^[^#$%>
]*[#$%>] *\(^[\[[0-9;]*[a-zA-Z] *\)*\)\'' not found in 30 secs]]


Any assistance would be greatly appreciated.

...Lyall


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Help with Emacs 22.2.1 using TRAMP and PuTTY/plink
  2008-05-01  6:35 Help with Emacs 22.2.1 using TRAMP and PuTTY/plink lyallp
@ 2008-05-04 11:23 ` Michael Albinus
       [not found] ` <mailman.11172.1209900210.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Albinus @ 2008-05-04 11:23 UTC (permalink / raw)
  To: lyallp; +Cc: help-gnu-emacs

lyallp <Lyall.Pearce@gmail.com> writes:

> unset HISTORY\r
>>^H^[]2 the_host - user_name - /home/user_name\auser_name@the_host:>^H~^M
> $
>>^H^[]2 the_host - user_name - /home/user_name\auser_name@the_host:>^H~^M
> $
>
> Any assistance would be greatly appreciated.

I'm not confident that Tramp's EOL handling is guilty. It looks like
your prompt includes escape sequences, which disturb Tramp in
general. You should suppress such settings, for example by setting your
prompt depending on the terminal type.

> ...Lyall

Best regards, Michael.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Help with Emacs 22.2.1 using TRAMP and PuTTY/plink
       [not found] ` <mailman.11172.1209900210.18990.help-gnu-emacs@gnu.org>
@ 2008-05-04 11:57   ` lyallp
  2008-05-04 21:40     ` Michael Albinus
       [not found]     ` <mailman.11182.1209937216.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: lyallp @ 2008-05-04 11:57 UTC (permalink / raw)
  To: help-gnu-emacs

Thanks for replying Michael.

I don't consider myself a noob at bash, but my problem is that I do
not know how to determine what the terminal is.
I can determine if it's an interactive login, but that does not help
me when it comes to TRAMP.
How do I differentiate me, from TRAMP?
Another part of my problem is that the server in question, on which I
am not an admin, sets TERM=vt100 in /etc/profile, unconditionally.

My PS1 string contains an escape sequence which updates my XTERM
window title with my "Host - User - pwd".

I looked in TRAMP and it's simply looking for a regexp (contained in
tramp-shell-prompt-pattern), which includes, amongst other junk, a
newline followed by $ space. (which my PS1 does have - I have my
username/host/pwd followed by a newline, then $ space - rather than
having the $ space at the end of a potentially long prompt string).

Even if it did think my prompt was earlier in the string, it does not
matter, so long as it proceeds, as almost the first thing TRAMP does
is start up /bin/sh with a prompt defined by itself as "$ "
The problem is it doesn't find my prompt without changing the end of
line parameter, which then screws up the execution of /bin/sh because
the character is interpreted as forming part of the /bin/sh filename
(much like if you edit a shell script with a windows editor - the #!/
bin/bash suddenly has a CR on the end and the script refuses to
execute because the system cannot find an executable called "/bin/bash
\r".

...Lyall

On May 4, 8:23 pm, Michael Albinus <michael.albi...@gmx.de> wrote:
> lyallp <Lyall.Pea...@gmail.com> writes:
> > unset HISTORY\r
> >>^H^[]2 the_host - user_name - /home/user_name user_name@the_host:>^H~^M
> > $
> >>^H^[]2 the_host - user_name - /home/user_name user_name@the_host:>^H~^M
> > $
>
> > Any assistance would be greatly appreciated.
>
> I'm not confident that Tramp's EOL handling is guilty. It looks like
> your prompt includes escape sequences, which disturb Tramp in
> general. You should suppress such settings, for example by setting your
> prompt depending on the terminal type.
>
> > ...Lyall
>
> Best regards, Michael.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Help with Emacs 22.2.1 using TRAMP and PuTTY/plink
  2008-05-04 11:57   ` lyallp
@ 2008-05-04 21:40     ` Michael Albinus
       [not found]     ` <mailman.11182.1209937216.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Albinus @ 2008-05-04 21:40 UTC (permalink / raw)
  To: lyallp; +Cc: help-gnu-emacs

lyallp <Lyall.Pearce@gmail.com> writes:

> Thanks for replying Michael.

Hi Lyall.

> I don't consider myself a noob at bash, but my problem is that I do
> not know how to determine what the terminal is.
> I can determine if it's an interactive login, but that does not help
> me when it comes to TRAMP.
> How do I differentiate me, from TRAMP?

The default test is [ $TERM = "dumb" ]

> Another part of my problem is that the server in question, on which I
> am not an admin, sets TERM=vt100 in /etc/profile, unconditionally.

That might be a problem, indeed. But first let's test whether setting a
simple prompt helps you.

> My PS1 string contains an escape sequence which updates my XTERM
> window title with my "Host - User - pwd".
>
> I looked in TRAMP and it's simply looking for a regexp (contained in
> tramp-shell-prompt-pattern), which includes, amongst other junk, a
> newline followed by $ space. (which my PS1 does have - I have my
> username/host/pwd followed by a newline, then $ space - rather than
> having the $ space at the end of a potentially long prompt string).
>
> Even if it did think my prompt was earlier in the string, it does not
> matter, so long as it proceeds, as almost the first thing TRAMP does
> is start up /bin/sh with a prompt defined by itself as "$ "

Not really. Tramp, for example, sends "unset HISTORY", and it sees your
prompt with the escape sequence. So please, as a first test, discard any
special prompt setting on the remote side, and see whether Tramp goes
through. If this test succeeds, we can investigate how you could
tetermine the presence of Tramp, if the test for $TERM is not
applicable.

If not, then we must continue with the EOL issue.

> ...Lyall

Best regards, Michael.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Help with Emacs 22.2.1 using TRAMP and PuTTY/plink
       [not found]     ` <mailman.11182.1209937216.18990.help-gnu-emacs@gnu.org>
@ 2008-05-05  8:19       ` Livin Stephen
  2008-05-05  9:33         ` lyallp
  0 siblings, 1 reply; 7+ messages in thread
From: Livin Stephen @ 2008-05-05  8:19 UTC (permalink / raw)
  To: help-gnu-emacs

I'll second that! I was facing tramp problems [albeit with 'sudo' on
my Mac], and I found that the problems [endless 'waiting 60s for ...']
went away when I switched back to a simple setting for 'PS1'

Now,
PS1: "\W\$ "
and tramp works fine.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Help with Emacs 22.2.1 using TRAMP and PuTTY/plink
  2008-05-05  8:19       ` Livin Stephen
@ 2008-05-05  9:33         ` lyallp
  2008-05-06  0:05           ` lyallp
  0 siblings, 1 reply; 7+ messages in thread
From: lyallp @ 2008-05-05  9:33 UTC (permalink / raw)
  To: help-gnu-emacs

Looks like the consensus is I should keep a simple Prompt string.

I will report back when I give it a whack.

...Lyall


On May 5, 5:19 pm, Livin Stephen <livin.step...@gmail.com> wrote:
> I'll second that! I was facing tramp problems [albeit with 'sudo' on
> my Mac], and I found that the problems [endless 'waiting 60s for ...']
> went away when I switched back to a simple setting for 'PS1'
>
> Now,
> PS1: "\W\$ "
> and tramp works fine.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Help with Emacs 22.2.1 using TRAMP and PuTTY/plink
  2008-05-05  9:33         ` lyallp
@ 2008-05-06  0:05           ` lyallp
  0 siblings, 0 replies; 7+ messages in thread
From: lyallp @ 2008-05-06  0:05 UTC (permalink / raw)
  To: help-gnu-emacs

Using a Redhat enterprise Virtual Machine as my testbed.

Can't set TERM to dumb, as plink is not considered a dumb terminal.
Thus, can't create a simple prompt string based on TERM.

Instead, I changed, using Customize -> Files -> Tramp, "Tramp Shell
Prompt Pattern" to (excluding quotes)

[#$%>]+ *$

Basically, looking for # or $ or % or > followed by zero or more
spaces followed by end of search buffer.

Works fine.

I have no idea why the prompt pattern is so complicated, by default.
The above pattern, quite nicely, skips over echoed commands, bypasses /
etc/issues (unless the banner is boxed in # symbols)

From the initial C-F /thehost~/ RET
to displaying my home directory, takes 7 seconds.

And, I still have my fancy prompt string which includes escape
sequences to update the terminal window title, which works with both
PuTTY and xterm.

...Lyall

On May 5, 6:33 pm, lyallp <Lyall.Pea...@gmail.com> wrote:
> Looks like the consensus is I should keep a simple Prompt string.
>
> I will report back when I give it a whack.
>
> ...Lyall
>
> On May 5, 5:19 pm, Livin Stephen <livin.step...@gmail.com> wrote:
>
> > I'll second that! I was facing tramp problems [albeit with 'sudo' on
> > my Mac], and I found that the problems [endless 'waiting 60s for ...']
> > went away when I switched back to a simple setting for 'PS1'
>
> > Now,
> > PS1: "\W\$ "
> > and tramp works fine.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-05-06  0:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-01  6:35 Help with Emacs 22.2.1 using TRAMP and PuTTY/plink lyallp
2008-05-04 11:23 ` Michael Albinus
     [not found] ` <mailman.11172.1209900210.18990.help-gnu-emacs@gnu.org>
2008-05-04 11:57   ` lyallp
2008-05-04 21:40     ` Michael Albinus
     [not found]     ` <mailman.11182.1209937216.18990.help-gnu-emacs@gnu.org>
2008-05-05  8:19       ` Livin Stephen
2008-05-05  9:33         ` lyallp
2008-05-06  0:05           ` lyallp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).