From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Daniel Pittman Newsgroups: gmane.emacs.bugs Subject: bug#28139: 25.2; TRAMP vs bash 4.4 / readline 7.0 "bracketed paste" mode Date: Mon, 21 Aug 2017 11:19:31 -0400 Message-ID: References: <87mv6vjv6c.fsf@detlef> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1142aa9ed4da5c055745039b" X-Trace: blaine.gmane.org 1503328882 15730 195.159.176.226 (21 Aug 2017 15:21:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 21 Aug 2017 15:21:22 +0000 (UTC) To: 28139@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 21 17:21:16 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djoVo-0003GH-LT for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Aug 2017 17:21:08 +0200 Original-Received: from localhost ([::1]:53902 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1djoVt-0005Gy-Nv for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Aug 2017 11:21:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1djoVm-0005Fy-ES for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 11:21:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1djoVh-0004gR-WC for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 11:21:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39312) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1djoVh-0004g9-RZ for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 11:21:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1djoVh-00011X-ME for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 11:21:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Pittman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Aug 2017 15:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28139 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28139-submit@debbugs.gnu.org id=B28139.15033288203849 (code B ref 28139); Mon, 21 Aug 2017 15:21:01 +0000 Original-Received: (at 28139) by debbugs.gnu.org; 21 Aug 2017 15:20:20 +0000 Original-Received: from localhost ([127.0.0.1]:47980 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djoV2-000100-Bg for submit@debbugs.gnu.org; Mon, 21 Aug 2017 11:20:20 -0400 Original-Received: from mail-qt0-f171.google.com ([209.85.216.171]:33290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djoV0-0000zo-5D for 28139@debbugs.gnu.org; Mon, 21 Aug 2017 11:20:18 -0400 Original-Received: by mail-qt0-f171.google.com with SMTP id d15so14037882qta.0 for <28139@debbugs.gnu.org>; Mon, 21 Aug 2017 08:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=9F27K8Qiu573QXR2khkauvEUPEmoFqMsXRpdhlgPKWQ=; b=k7+oDy8yq0aYCoG+ZZuy6e/4/g0omS72bVWl+VqG1nDZP87Ao8oLDIJrDXE+WMA+Fm Wy8S1+wLn/zI2Uh3IN93PGYmLTPbdpbhe8HiELOqtDQxnG+ZQwchDLMu56IwH2PCKyl+ JBTF4N1D3g6DdhG6g9CnMVZ3ErvUG/NYpEqs7xEOlcSitwToyTuBmIdBDpIbShm8pgLM EF1kIk3shLQBAJaCSA4P1OwPLH3eIKAJ5jMaVoOhPV8MZnTdLqxXK1Mpc0Ea2JISC9km sqOZDzpyBtlO8LbXpXPGdGmqr/IfIqbr6m0jD4bWQaguGZRA9HYSNg7GUayBK2ZOeQos nV4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=9F27K8Qiu573QXR2khkauvEUPEmoFqMsXRpdhlgPKWQ=; b=nY3P/To5/cfmSxwd33ZbEfvIVl+r2LjQL5sdyeLAj6/MPgzQiRXf8sdjOwjqHmN4lE XK61p81i3/ATg4H+APBENQe5J7Vea9Xf1Vkx264r1DfRTq+wzlo5MO++5j0nXivFzbY2 qgfbza1nchoIasuPaHq/xtg/Cq4uBKS/Xqly5uopG0CHqG9lYM2T83pnFmzjA21d7Kxp X4SZSnmhTFCpDke1SIZdNSl9m4LMR6gHNmqjPx8fUUaVqDR0/YD/azDIT5mEDOqA7ZZO 19L/z4aWOT7hp/GEkiVEUipdgotps3Tk8DG6y9x90gAYpjXVGEv2zdtbRM0zc0sB3Vf8 C5nA== X-Gm-Message-State: AHYfb5iNQ4d2BVDXZtDJLzpbrtl3gfWo5bdm6nU8VyLog7UjhsGidLiM XdlLmDSn2mbYQveObvGjf4d6jN4KH1AGGMBZqw== X-Received: by 10.200.45.215 with SMTP id q23mr1065038qta.133.1503328812166; Mon, 21 Aug 2017 08:20:12 -0700 (PDT) Original-Received: by 10.200.51.177 with HTTP; Mon, 21 Aug 2017 08:19:31 -0700 (PDT) In-Reply-To: <87mv6vjv6c.fsf@detlef> 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: 208.118.235.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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:135999 Archived-At: --001a1142aa9ed4da5c055745039b Content-Type: text/plain; charset="UTF-8" On Sat, Aug 19, 2017 at 1:59 PM, Michael Albinus wrote: > > After upgrading a remote system to a version of GNU/Linux that > > includes bash > > 4.4 (from Debian/testing), with the readline option `set > > enable-bracketed-paste on` in /etc/inputrc, and no personal inputrc, > > tramp breaks. > > Many different shells are busy to break Tramp. > Believe me, I know the pain. This isn't my first time poking into the internals of how TRAMP hits remote shells. > > Passing the `--noediting` option to the remote shell command resolves > > the problem, by disabling readline entirely, but it should also be > > possible to augment the > > `tramp-open-connection-setup-interactive-shell` to issue, > > unconditionally, the command: > > > > bind 'set enable-bracketed-paste off' > > Does it help to add the following line into your remote ~/.bashrc: > > [ $TERM = "dumb" ] && bind 'set enable-bracketed-paste off' > Alas, no, and the bash(1) man page "INVOCATION" section makes it clear why: Since a shell invoked as sh does not attempt to read and execute commands from any other startup files, the --rcfile option has no effect. Interactive testing confirms this: if I invoke the shell the as TRAMP does, with: env ENV='' HISTFILE='' HISTFILESIZE=0 HISTSIZE=0 PROMPT_COMMAND='' PS1=\#\$\ PS2='' PS3='' /bin/sh ...then strace confirms that no init files are read, other than /etc/inputrc So, it's not possible to work around this issue without injecting additional code into the shell setup process, using `/bin/sh --noediting`, or using an interactive shell and adding that to the .profile or equivalent. note: --noediting has been present since bash 2.0 according to their changelog, so it may be reasonable to add by default to the non-interactive shell invocations. Ultimately, though, perhaps adding the ability to run additional commands during the interactive shell setup process and/or consuming any CSI sequences prior to matching, would be a more future-proof solution to this. --001a1142aa9ed4da5c055745039b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On S= at, Aug 19, 2017 at 1:59 PM, Michael Albinus <michael.albinus@gmx.de= > wrote:
> After upgrading a remote system to a version of GNU/Linux that
> includes bash
> 4.4 (from Debian/testing), with the readline option `set
> enable-bracketed-paste on` in /etc/inputrc, and no personal inputrc, > tramp breaks.

Many different shells are busy to break Tramp.

Believe me, I know the pain.=C2=A0 This isn't my first time pok= ing into the internals of how TRAMP hits remote shells.
=C2=A0
> Passing the `--noediting` option to the remote shell command resolves<= br> > the problem, by disabling readline entirely, but it should also be
> possible to augment the
> `tramp-open-connection-setup-interactive-shell` to issue,
> unconditionally, the command:
>
>=C2=A0 =C2=A0 =C2=A0bind 'set enable-bracketed-paste off'

Does it help to add the following line into your remote ~/.bashrc:

[ $TERM =3D "dumb" ] && bind 'set enable-bracketed-pa= ste off'

Alas, no, and the bash(1) = man page "INVOCATION" section makes it clear why:

<= /div>
=C2=A0 =C2=A0 Since a shell invoked as sh does not attempt t= o read and=C2=A0
=C2=A0 =C2=A0 execute commands from any other st= artup files,=C2=A0
=C2=A0 =C2=A0 the --rcfile option has no effec= t.

Interactive testing confirms this: if I i= nvoke the shell the as TRAMP does, with:

env ENV= =3D'' HISTFILE=3D'' HISTFILESIZE=3D0 HISTSIZE=3D0 PROMPT_CO= MMAND=3D'' PS1=3D\#\$\ =C2=A0PS2=3D'' PS3=3D'' /bin= /sh=C2=A0

...then strace confirms that no init= files are read, other than /etc/inputrc

So, it= 9;s not possible to work around this issue without injecting additional cod= e into the shell setup process, using `/bin/sh --noediting`, or using an in= teractive shell and adding that to the .profile or equivalent.
note: --noediting has been present since bash 2.0 according to= their changelog, so it may be reasonable to add by default to the non-inte= ractive shell invocations.

Ultimately, though, per= haps adding the ability to run additional commands during the interactive s= hell setup process and/or consuming any CSI sequences prior to matching, wo= uld be a more future-proof solution to this.
--001a1142aa9ed4da5c055745039b--