all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noah Friedman <friedman@splode.com>
To: michael.albinus@gmx.de
Cc: emacs-devel@gnu.org
Subject: Re: master 1196e3f: (tramp-open-connection-setup-interactive-shell): Send -onlcr as well.
Date: Mon, 12 Oct 2015 11:37:35 -0700 (PDT)	[thread overview]
Message-ID: <20151012113735.549056.FMU3051@unexploded-cow.prv.splode.com> (raw)
In-Reply-To: <87egh0feec.fsf@gmx.de> (michael.albinus@gmx.de Monday, 12 Oct 15 14:40:59 +0200)

>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 <87egh0feec.fsf@gmx.de>, Michael Albinus writes:
>Noah Friedman <friedman+savannah@splode.com> 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	other threads:[~2015-10-12 18:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20151009231545.12874.47698@vcs.savannah.gnu.org>
     [not found] ` <E1Zkgt7-0003MK-9L@vcs.savannah.gnu.org>
2015-10-12 12:40   ` master 1196e3f: (tramp-open-connection-setup-interactive-shell): Send -onlcr as well Michael Albinus
2015-10-12 18:37     ` Noah Friedman [this message]
2015-10-13  8:09       ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151012113735.549056.FMU3051@unexploded-cow.prv.splode.com \
    --to=friedman@splode.com \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.