From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: John F Carr Newsgroups: gmane.emacs.bugs Subject: bug#39399: tramp depends on unstable details of shell command line processing Date: Sun, 2 Feb 2020 21:28:40 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="8944"; mail-complaints-to="usenet@ciao.gmane.io" To: 39399@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 02 22:30:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iyMon-0002Do-52 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 Feb 2020 22:30:13 +0100 Original-Received: from localhost ([::1]:59766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iyMom-0003Df-3o for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 Feb 2020 16:30:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53340) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iyMod-0003DZ-Re for bug-gnu-emacs@gnu.org; Sun, 02 Feb 2020 16:30:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iyMoc-000618-Kw for bug-gnu-emacs@gnu.org; Sun, 02 Feb 2020 16:30:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34699) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iyMoc-00060W-Hr for bug-gnu-emacs@gnu.org; Sun, 02 Feb 2020 16:30:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iyMoc-0003Kb-D4 for bug-gnu-emacs@gnu.org; Sun, 02 Feb 2020 16:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: John F Carr Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Feb 2020 21:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 39399 X-GNU-PR-Package: emacs X-Debbugs-Original-To: "bug-gnu-emacs@gnu.org" Original-Received: via spool by submit@debbugs.gnu.org id=B.158067894612711 (code B ref -1); Sun, 02 Feb 2020 21:30:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Feb 2020 21:29:06 +0000 Original-Received: from localhost ([127.0.0.1]:40672 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iyMni-0003Iw-0Y for submit@debbugs.gnu.org; Sun, 02 Feb 2020 16:29:06 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:48277) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iyMng-0003Io-0f for submit@debbugs.gnu.org; Sun, 02 Feb 2020 16:29:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53138) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iyMne-0002sl-0w for bug-gnu-emacs@gnu.org; Sun, 02 Feb 2020 16:29:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iyMnb-00050l-5t for bug-gnu-emacs@gnu.org; Sun, 02 Feb 2020 16:29:01 -0500 Original-Received: from outgoing-exchange-5.mit.edu ([18.9.28.59]:34860) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iyMnb-0004zy-2N for bug-gnu-emacs@gnu.org; Sun, 02 Feb 2020 16:28:59 -0500 Original-Received: from w92exedge4.exchange.mit.edu (W92EXEDGE4.EXCHANGE.MIT.EDU [18.7.73.16]) by outgoing-exchange-5.mit.edu (8.14.7/8.12.4) with ESMTP id 012LVXO6003414 for ; Sun, 2 Feb 2020 16:31:50 -0500 Original-Received: from OC11EXPO29.exchange.mit.edu (18.9.4.102) by w92exedge4.exchange.mit.edu (18.7.73.16) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Sun, 2 Feb 2020 16:26:52 -0500 Original-Received: from OC11EXPO29.exchange.mit.edu (18.9.4.102) by oc11expo29.exchange.mit.edu (18.9.4.102) with Microsoft SMTP Server (TLS) id 15.0.1365.1; Sun, 2 Feb 2020 16:28:40 -0500 Original-Received: from OC11EXPO29.exchange.mit.edu ([18.9.4.102]) by oc11expo29.exchange.mit.edu ([18.9.4.102]) with mapi id 15.00.1365.000; Sun, 2 Feb 2020 16:28:40 -0500 Thread-Topic: tramp depends on unstable details of shell command line processing Thread-Index: AQHV2g+8Za6b5HSxCUGFARxk5V5iKA== Accept-Language: en-US Content-Language: en-US x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [108.7.221.50] Content-ID: <54D03A83E9FFC645973CC548FBFA19BF@exchange.mit.edu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:175615 Archived-At: I use emacs tramp mode for remote editing. It stopped working on my FreeBS= D systems when I upgraded to a development version. The cause appears to b= e due to /bin/sh reprinting the entire line when a backspace is sent rather= than sending only a backspace-space-backspace sequence. The failure follo= ws a change in the line editing library (shared with NetBSD) rather than th= e shell itself. Environment is emacs 24.5 or 26.3 running on Mac OS Catalina. The remote s= ystem is FreeBSD 13.0 development. Tramp works with Linux or FreeBSD 12.1 = as the remote system. Here's what happens. I load tramp and open a file like /ssh:user@host:/. Emacs spawns ssh to co= nnect. The first thing tramp does is send stty -inlcr -onlcr -echo kill '^U' erase '^H' But this doesn't do much because the tty is in raw mode rather than cooked = due to the shell's line editor. So tramp falls back to a hack to detect ec= hoed input. It sends "_echo" followed by a string of backspace characters.= "_echo" is unlikely to appear in program output. Here is the next command after the initial stty: _echo^H^H^H^H^Hstty icanon erase ^H cols 32767_echo^H^H^H^H^H The groups of 5 ^H represent 5 backspace characters and the lone ^H in the = middle is a two character sequence for stty. The terminal output from a 12.1 system is _echo^H ^H^H ^H^H ^H^H ^H^H ^Hstty icanon erase ^H cols 32767_echo^H ^H^H ^= H^H ^H^H ^H^H ^H #$=20 where again the middle ^H is a two character sequence and the others are ba= ckspace characters. There is a carriage return between the two lines. "#$ = " is the shell prompt set by tramp. The terminal output from a FreeBSD 13.0 development branch system is _echo #$ _ech ^H #$ _ec ^H #$ _e ^H #$ _ ^H #$ ^Hstty icanon erase ^H cols 32767_echo #$ stty icanon erase ^H cols 32767_ech ^H #$ stty icanon erase ^H cols 32767_ec ^H #$ stty icanon erase ^H cols 32767_e ^H #$ stty icanon erase ^H cols 32767_ ^H #$ stty icanon erase ^H cols 32767 ^H #$=20 with carriage returns between lines. This does not make sense to emacs, wh= ich hangs waiting for something it recognizes. I can recover by hitting co= ntrol-G which aborts the tramp connection. This issue is also reported to FreeBSD at https://bugs.freebsd.org/bugzilla= /show_bug.cgi?id=3D243807.=