emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 1196e3f: (tramp-open-connection-setup-interactive-shell): Sen


From: Noah Friedman
Subject: Re: master 1196e3f: (tramp-open-connection-setup-interactive-shell): Send -onlcr as well.
Date: Mon, 12 Oct 2015 11:37:35 -0700 (PDT)

>Could you pls explain the reason for this change? The default setting is
>"onlcr", which is also used when you apply "stty sane".

That's exactly the problem.  Tramp runs an "interactive" shell on the
remote end; specifically, it sets "PS1".  That means that if your remote
shell's .profile or .bashrc thinks you're interactive and runs "stty sane"
as part of the usual login process, then the onlcr flag gets set and all of
the output lines end with ^M.  Subsequently, after trying to search for
commands to run on the remote end, tramp tries to send commands like
"/usr/bin/ls^M -args" and concludes that there is no valid ls on the remote
system.

Evidence from my .bash_history file on the remote end once I disabled my
.bashrc entirely:

        exec env ENV='' HISTFILE=/dev/null PROMPT_COMMAND='' PS1=\#\$\  PS2='' 
PS3='' /bin/sh

I've known for many years to put a guard in my .bashrc along the lines of

        case $PS1 in '' ) return 0 ;; esac

before doing anything that would confuse batch processing, but tramp was
specifically defeating that.

This is not just some perverse behavior on my part.  This is standard idiom
for shell initialization.  Actually, tramp is bound to cause all kinds of
other trouble besides by doing this, but at the very least, forcing -onlcr
will avoid screwing up absolutely every line of output.

And funny you should say the current settings have been used for years,
because for years tramp hasn't worked for me and I finally got tired of
trying it once in a while and seeing that it still didn't work.  I've been
punting and setting up sshfs connections manually instead, but I was in a
mood last week and decided to debug it.

In <address@hidden>, Michael Albinus writes:
>Noah Friedman <address@hidden> writes:
>
>Hi Noah,
>
>> diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
>> index 433b2ba..7d24b54 100644
>> --- a/lisp/net/tramp-sh.el
>> +++ b/lisp/net/tramp-sh.el
>> @@ -4153,7 +4153,7 @@ process to set up.  VEC specifies the connection."
>>  
>>      ;; Disable tab and echo expansion.
>>      (tramp-message vec 5 "Setting up remote shell environment")
>> -    (tramp-send-command vec "stty tab0 -inlcr -echo kill '^U' erase '^H'" t)
>> +    (tramp-send-command vec "stty tab0 -inlcr -onlcr -echo kill '^U' erase 
>> '^H'" t)
>>      ;; Check whether the echo has really been disabled.  Some
>>      ;; implementations, like busybox of embedded GNU/Linux, don't
>>      ;; support disabling.
>
>Could you pls explain the reason for this change? The default setting is
>"onlcr", which is also used when you apply "stty sane".
>
>Is there a problem you have detected with Tramp? The current settings
>are used for 10+ years, and nobody did report yet.
>
>Thanks, and best regards, Michael.
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]