* Re: master 1196e3f: (tramp-open-connection-setup-interactive-shell): Send -onlcr as well. [not found] ` <E1Zkgt7-0003MK-9L@vcs.savannah.gnu.org> @ 2015-10-12 12:40 ` Michael Albinus 2015-10-12 18:37 ` Noah Friedman 0 siblings, 1 reply; 3+ messages in thread From: Michael Albinus @ 2015-10-12 12:40 UTC (permalink / raw) To: emacs-devel; +Cc: Noah Friedman 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. ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: master 1196e3f: (tramp-open-connection-setup-interactive-shell): Send -onlcr as well. 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 2015-10-13 8:09 ` Michael Albinus 0 siblings, 1 reply; 3+ messages in thread From: Noah Friedman @ 2015-10-12 18:37 UTC (permalink / raw) To: michael.albinus; +Cc: emacs-devel >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. > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: master 1196e3f: (tramp-open-connection-setup-interactive-shell): Send -onlcr as well. 2015-10-12 18:37 ` Noah Friedman @ 2015-10-13 8:09 ` Michael Albinus 0 siblings, 0 replies; 3+ messages in thread From: Michael Albinus @ 2015-10-13 8:09 UTC (permalink / raw) To: Noah Friedman; +Cc: emacs-devel Noah Friedman <friedman@splode.com> writes: > 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. I see. Strange enough, that nobody else did report ever. > 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. Tramp sets TERM=dumb; you could test for it. > 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. sshfs has its merits, but when it comes to running processes on the remote side, you need Tramp. Well, I've pushed your patch also into the Tramp git repo. Let's see whether people will kill us because of this. I plan to release Tramp 2.2.13 end of the year (if I survive), until then there's enough time to get reports from people using either Emacs git master or Tramp git master. Thanks for all your work, and best regards, Michael. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-13 8:09 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [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 2015-10-13 8:09 ` Michael Albinus
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.