From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Friedman Newsgroups: gmane.emacs.devel Subject: Re: master 1196e3f: (tramp-open-connection-setup-interactive-shell): Send -onlcr as well. Date: Mon, 12 Oct 2015 11:37:35 -0700 (PDT) Message-ID: <20151012113735.549056.FMU3051@unexploded-cow.prv.splode.com> References: <20151009231545.12874.47698@vcs.savannah.gnu.org> <87egh0feec.fsf@gmx.de> Reply-To: Noah Friedman NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1444679195 30244 80.91.229.3 (12 Oct 2015 19:46:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 Oct 2015 19:46:35 +0000 (UTC) Cc: emacs-devel@gnu.org To: michael.albinus@gmx.de Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 12 21:46:27 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zlj3A-0004uW-UY for ged-emacs-devel@m.gmane.org; Mon, 12 Oct 2015 21:46:25 +0200 Original-Received: from localhost ([::1]:58262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zlj3A-0000I3-Jx for ged-emacs-devel@m.gmane.org; Mon, 12 Oct 2015 15:46:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44613) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zlj2x-0000Hi-On for emacs-devel@gnu.org; Mon, 12 Oct 2015 15:46:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zlj2t-0003hl-GH for emacs-devel@gnu.org; Mon, 12 Oct 2015 15:46:11 -0400 Original-Received: from bacon-event-horizon.splode.com ([2600:3c01::f03c:91ff:fe96:f92b]:42815 helo=splode.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zlj2t-0003hN-9D for emacs-devel@gnu.org; Mon, 12 Oct 2015 15:46:07 -0400 Original-Received: from unexploded-cow.prv.splode.com (prv.splode.com [173.8.128.9]) (authenticated bits=0) by splode.com (8.14.8/8.14.8) with ESMTP id t9CIbZS4024083 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Mon, 12 Oct 2015 11:38:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=splode.com; s=splode-20130101; t=1444675081; bh=Fovl6VCclDVEnhYAZw4So2TvhhLXuG+rfp2PAoenQI0=; h=From:To:Cc:Subject:Reply-To:In-Reply-To:References:Date:From; b=Aur85iHSOv4G7ofoNBzebXDw25Tja2KmISMrcEexBM37RRwtdwsuo2sRkUAhtMi09 fN5tpHrec1HqLnJuIj4mX+b2lxTYsrgxDiL60Kh4BhuGh2jptxTJxUFPXtJaSTOYpg E5lvzk0Fnrq/dKZNo0DdKPtcTMFg967W3DWpSLrc= In-Reply-To: <87egh0feec.fsf@gmx.de> (michael.albinus@gmx.de Monday, 12 Oct 15 14:40:59 +0200) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (splode.com [74.207.245.10]); Mon, 12 Oct 2015 11:38:01 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2600:3c01::f03c:91ff:fe96:f92b X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:191384 Archived-At: >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 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. >