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 12:01:48 -0400 Message-ID: References: <87mv6vjv6c.fsf@detlef> <8760dgapqm.fsf@detlef> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c09830e062e620557459bfa" X-Trace: blaine.gmane.org 1503331439 2457 195.159.176.226 (21 Aug 2017 16:03:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 21 Aug 2017 16:03:59 +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 18:03:54 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 1djpB9-0000DQ-EJ for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Aug 2017 18:03:51 +0200 Original-Received: from localhost ([::1]:57365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1djpBF-0001PW-Rb for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Aug 2017 12:03:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1djpAQ-0000mV-BS for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 12:03:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1djpAM-0000Al-Cn for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 12:03:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39369) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1djpAM-0000Ag-90 for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 12:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1djpAL-0003td-UX for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2017 12:03: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 16:03: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.150333135714947 (code B ref 28139); Mon, 21 Aug 2017 16:03:01 +0000 Original-Received: (at 28139) by debbugs.gnu.org; 21 Aug 2017 16:02:37 +0000 Original-Received: from localhost ([127.0.0.1]:48050 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djp9x-0003t0-0J for submit@debbugs.gnu.org; Mon, 21 Aug 2017 12:02:37 -0400 Original-Received: from mail-qk0-f180.google.com ([209.85.220.180]:37741) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djp9u-0003sn-Md for 28139@debbugs.gnu.org; Mon, 21 Aug 2017 12:02:35 -0400 Original-Received: by mail-qk0-f180.google.com with SMTP id z18so84786325qka.4 for <28139@debbugs.gnu.org>; Mon, 21 Aug 2017 09:02:34 -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=Dercr+/kapkqG1DRt1sYM8/15xFDcraWyZ4v6bn1rWA=; b=N+53YQ9JHEAYjonziBBiVLNjhVvQjW2RNMFcRXlMwNUnSDhwRJ4jWdcIyU6NrS1Hpd 6ZVNZ5MJnvPLotnovA50ykDh/nG7BCWHy6sjh286TnMddVbo38Xvvh9hV4xZGK3QZauC kRylVqckM90xU50PxOw8AWYnX62by1jHXtb3EFScutydXgDaNwpW1vSLrASS+++Sav2X NSoIenG/bomkc+leIdrwE0XTWhKUJHFN25gybeil1SZ+RNVmIpv0u6SHQMgHuUSJU1gJ Sgz1IyaOtHKWCynWIMWM2sSOAE7IgQyZhFZ+dAYzr9A13J4yd9bjk0wWnv8HuIk7OYKC 27vg== 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=Dercr+/kapkqG1DRt1sYM8/15xFDcraWyZ4v6bn1rWA=; b=Y3gBN6vZdIjTUbfwwlbb+5+j8HvGgIePt53r5ju/TySO0oWLj97UAYw1aNGpbISfjx uSs9RUTYx7xTU7fUEUuOE/Kuv0YyitW0CHRgGScxT6Y3kVz1oXExvmAurT28aAdLQ1sl sjljp2A1V7CeAtRYQDjKro4tN72w8HeJh/RMtqY0Ub3q6DQTeteKOgEDmbi55Jz2Diir C0sD923Ds2dXEN0mAFeeH0RQTK/COwA215ZSdcl6C4wY01IDJNa9EgoE5h8X1HnmHMCe tpMIDbcRL+hB/w0BKkiiv2ryyt6UNoPgt1xT53ONB1tbWfdbaHNcyoV93rV4QY5+aJZW zNHg== X-Gm-Message-State: AHYfb5gtCNjMxx0x0PnIarIvz5DUeVxs4pz7hve9+QQ884Jghb0oNjwV uqBSGqEv/Xzvb9/etW2jhdsHCSysjPNUEmZAVg== X-Received: by 10.233.237.136 with SMTP id c130mr2365586qkg.107.1503331348752; Mon, 21 Aug 2017 09:02:28 -0700 (PDT) Original-Received: by 10.200.51.177 with HTTP; Mon, 21 Aug 2017 09:01:48 -0700 (PDT) In-Reply-To: <8760dgapqm.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:136004 Archived-At: --94eb2c09830e062e620557459bfa Content-Type: text/plain; charset="UTF-8" On Mon, Aug 21, 2017 at 11:45 AM, Michael Albinus wrote: > > Well, we have `tramp-sh-extra-args' for ages. But this doesn't work > usually, because I don't know a bullet-proof way to detect a bash shell > prior invocation, unless "*bash" is called. > *nod* The best I can think of, since we already have the "outer" shell, would be to invoke `/bin/sh --version -c exit`, which should work on any basic posix shell, and will emit a bash version string for bash, then wait for the prompt, and scan the output for the appropriate version data. Let me contemplate about. With Emacs 26 / Tramp 2.3, we have > connection-local variables. Maybe we could use it for your case. > FWIW, I already extend `tramp-actions-before-shell`, so something similarly low level would be fine by me, to handle the custom stuff. However, `ansi-color-filter-region` and friends from the shipped ANSI SGR->face handling library can strip all control sequences out of a region, or string, and might be useful here; that would allow TRAMP to become insensitive to ANSI control codes injected anywhere into the output, which will also fix the next time a shell decides to add some additional terminal integration like bracketed paste mode. If you want to apply this to streaming output, because that will rewrite the buffer fragment with a smaller number of characters in the presence of control codes, throw a marker at your endpoint, and retrieve the position after the stripping, to avoid getting confused about the new offset. --94eb2c09830e062e620557459bfa Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On M= on, Aug 21, 2017 at 11:45 AM, Michael Albinus <michael.albinus@gmx.de= > wrote:
Wel= l, we have `tramp-sh-extra-args' for ages. But this doesn't work usually, because I don't know a bullet-proof way to detect a bash shell=
prior invocation, unless "*bash" is called.
=
*nod* =C2=A0The best I can think of, since we already have t= he "outer" shell, would be to invoke `/bin/sh --version -c exit`,= which should work on any basic posix shell, and will emit a bash version s= tring for bash, then wait for the prompt, and scan the output for the appro= priate version data.

Let me contemplate about. With Emacs 26 / Tramp 2.3, we have
connection-local variables. Maybe we could use it for your case.

FWIW, I already extend `tramp-actions-before-shel= l`, so something similarly low level would be fine by me, to handle the cus= tom stuff.

However, `ansi-color-filter-region` and= friends from the shipped ANSI SGR->face handling library can strip all = control sequences out of a region, or string, and might be useful here; tha= t would allow TRAMP to become insensitive to ANSI control codes injected an= ywhere into the output, which will also fix the next time a shell decides t= o add some additional terminal integration like bracketed paste mode.
=

If you want to apply this to streaming output, because = that will rewrite the buffer fragment with a smaller number of characters i= n the presence of control codes, throw a marker at your endpoint, and retri= eve the position after the stripping, to avoid getting confused about the n= ew offset.
--94eb2c09830e062e620557459bfa--