From owner-freebsd-current@freebsd.org Tue Jan 28 16:58:24 2020 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABC212334ED for ; Tue, 28 Jan 2020 16:58:24 +0000 (UTC) (envelope-from jfc@mit.edu) Received: from outgoing-exchange-7.mit.edu (outgoing-exchange-7.mit.edu [18.9.28.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.outgoing-exchange.mit.edu", Issuer "InCommon RSA Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 486Xqz6fJnz4CqL for ; Tue, 28 Jan 2020 16:58:23 +0000 (UTC) (envelope-from jfc@mit.edu) Received: from w92exedge4.exchange.mit.edu (W92EXEDGE4.EXCHANGE.MIT.EDU [18.7.73.16]) by outgoing-exchange-7.mit.edu (8.14.7/8.12.4) with ESMTP id 00SGw807024891 for ; Tue, 28 Jan 2020 11:58:14 -0500 Received: from w92expo29.exchange.mit.edu (18.7.74.41) by w92exedge4.exchange.mit.edu (18.7.73.16) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Tue, 28 Jan 2020 11:55:20 -0500 Received: from OC11EXPO29.exchange.mit.edu (18.9.4.102) by w92expo29.exchange.mit.edu (18.7.74.41) with Microsoft SMTP Server (TLS) id 15.0.1365.1; Tue, 28 Jan 2020 11:57:58 -0500 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; Tue, 28 Jan 2020 11:57:58 -0500 From: John F Carr To: "freebsd-current@freebsd.org" Subject: Emacs tramp mode doesn't work with CURRENT Thread-Topic: Emacs tramp mode doesn't work with CURRENT Thread-Index: AQHV1fwXD6fi2HIsu0G99z3cF1tJDA== Date: Tue, 28 Jan 2020 16:57:58 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [108.7.221.50] Content-Type: text/plain; charset="us-ascii" Content-ID: <3D76CBE5E7137240B9AEFF38F0CC629C@exchange.mit.edu> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Rspamd-Queue-Id: 486Xqz6fJnz4CqL X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jfc@mit.edu designates 18.9.28.58 as permitted sender) smtp.mailfrom=jfc@mit.edu X-Spamd-Result: default: False [-3.47 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_COUNT_FIVE(0.00)[5]; HAS_XOIP(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:18.9.28.0/24]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; DMARC_NA(0.00)[mit.edu]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-0.97)[ipnet: 18.9.0.0/16(-4.79), asn: 3(-0.03), country: US(-0.05)]; RCVD_IN_DNSWL_MED(-0.20)[58.28.9.18.list.dnswl.org : 127.0.11.2]; TO_DN_EQ_ADDR_ALL(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[58.28.9.18.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:3, ipnet:18.9.0.0/16, country:US]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jan 2020 16:58:24 -0000 I use emacs tramp mode, which opens an ssh connection to a remote machine f= or file access. It works to Linux and FreeBSD 12.1, but not to CURRENT. T= here has been a change in the way characters are echoed by the shell, with = 12.1 treating a consecutive run of backspace as an atomic unit and CURRENT = processing them one at a time. This is not necessarily a bug, but it is a = nuisance and independently it is suboptimal. I would like to blame libedit, which changed since 12.1. I didn't see any = changes in pty code and the problem happens with at least two different she= lls. It could also be caused by a change to sshd or something I haven't th= rough of. Here is a longer explanation. Emacs tramp mode opens an ssh connection to a remote machine. It doesn't w= ant to see input echoed back so it runs stty -inlcr -onlcr -echo kill '^U' erase '^H' This doesn't do anything useful if a shell is running in line editing mode = (raw) instead of using the tty (cooked). So tramp falls back to a hack to = detect echoed input. It sends "_echo" followed by a string of backspace ch= aracters. "_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 CURRENT 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. I tried both /bin/sh and /bin/csh as shells and tramp didn't work with eith= er. I put set +V and set +E in my .profile thinking that would turn off li= ne editing but there was no change. Probably the shell still takes raw inp= ut. A possible complicating factor is the CURRENT machines are both 64 bit ARM = and the 12.1 machine is amd64. One has unsigned characters, the other sign= ed. Shouldn't matter, but I haven't tried 12.1 on ARM so I can't swear it = works.=