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, 13 Nov 2017 14:41:30 -0500 Message-ID: References: <87mv6vjv6c.fsf@detlef> <8760dgapqm.fsf@detlef> <871so4ao9n.fsf@detlef> <87pobkdrxp.fsf@detlef> <87fu9srj1p.fsf@gmx.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="001a113d351874a71a055de27778" X-Trace: blaine.gmane.org 1510602282 16298 195.159.176.226 (13 Nov 2017 19:44:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 13 Nov 2017 19:44:42 +0000 (UTC) Cc: 28139@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 13 20:44:38 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 1eEKeq-0003z4-S2 for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Nov 2017 20:44:37 +0100 Original-Received: from localhost ([::1]:56115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEKey-0003i5-2J for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Nov 2017 14:44:44 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEKdP-0002e7-VZ for bug-gnu-emacs@gnu.org; Mon, 13 Nov 2017 14:43:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEKdL-0001ge-20 for bug-gnu-emacs@gnu.org; Mon, 13 Nov 2017 14:43:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58455) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eEKdK-0001gR-SO for bug-gnu-emacs@gnu.org; Mon, 13 Nov 2017 14:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eEKdK-00063o-Gg for bug-gnu-emacs@gnu.org; Mon, 13 Nov 2017 14:43:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Pittman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Nov 2017 19:43:02 +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.151060213923233 (code B ref 28139); Mon, 13 Nov 2017 19:43:02 +0000 Original-Received: (at 28139) by debbugs.gnu.org; 13 Nov 2017 19:42:19 +0000 Original-Received: from localhost ([127.0.0.1]:38900 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eEKcc-00062f-Ps for submit@debbugs.gnu.org; Mon, 13 Nov 2017 14:42:19 -0500 Original-Received: from mail-qt0-f182.google.com ([209.85.216.182]:46980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eEKcb-00062O-Gn for 28139@debbugs.gnu.org; Mon, 13 Nov 2017 14:42:17 -0500 Original-Received: by mail-qt0-f182.google.com with SMTP id 1so21030072qtn.3 for <28139@debbugs.gnu.org>; Mon, 13 Nov 2017 11:42:17 -0800 (PST) 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 :cc; bh=AuCLmQdAyxMA6DqP+tm1n1mYsVAeSyXR8B0VAZ4z9Ys=; b=RGhUucRVOuSbJ8BKFTZQ7rGTAgxmMR1l6XQjlCdVdoHH6+FddpEcZX27GzosBKNaNR gHeVC59jEysU+OHwQLYhJn5+nb6YEH7KPDcY5SSB8uSlgdrgCGT/JkORqd6k+FmLMj9y yuD9wqoCaGlyExgb2jpUGWdhCyIEF7KAT01I6N7KsOsEmuuCH1vVMdJxfVRLNxof6F+B YSXaW/T04XTxdic0QKAtZ8xD/JS5Jd2QU4t7QoKn+CxMGAuDo8SyRLWBHQ8uuYYMafVp QfRueWcsMgsVIsPNvAtYo21NYYDZA3CveUBu4FYQZSiatJ0oYrM8F/BPjOlo0Tj7sI5m Io1A== 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:cc; bh=AuCLmQdAyxMA6DqP+tm1n1mYsVAeSyXR8B0VAZ4z9Ys=; b=XhBLmbQWtz2ewZrYc63MqRB81hit1cYp43iRKGfPKHU8dDO4rlhPHgkIVVITB1iYKB cMWyk1mmpKjk5sWIzjFi4cboK264hUvmQ6140hjKvAbsCOXvSrKTtTmjp/XsekZ3hJ/U 0nPOttPuORbqyzsu9Qp/huq0sh5sZNiiWGdHJ1cwDUGhYDdLsBgbvfkpWrbu1NMQqHfp wn5+4/lWHAESvbyjcZpDoUOLPZgMTKcngV3+8/Yo2kuUr4Dpdbaa564C3DZF2LcVvcRl inLrogGt4q4I6vbtf1JTKVmHb5XXLFrtv1wjp0QZT+pOISvOfh6eCxCNmiK5UJvvCw3A wlQg== X-Gm-Message-State: AJaThX5hfZvAyrgd9gF/DeOepKow5wiH0vtV9JwSRMSfhAa/o/oyafxG yFWnChsoJietO6VxZGMWyhOLk6/o8bW4lLmSqhOwdA== X-Google-Smtp-Source: AGs4zMbUUCqbrCxiYaQGr1Y4+dv1NxdA4CbnvQT01EMe8RKZSABRaY7rkl6kk9GxHIeUyaMqlCZBU+1wRfYiwhmKMw0= X-Received: by 10.200.34.245 with SMTP id g50mr15777484qta.62.1510602131620; Mon, 13 Nov 2017 11:42:11 -0800 (PST) Original-Received: by 10.237.51.98 with HTTP; Mon, 13 Nov 2017 11:41:30 -0800 (PST) In-Reply-To: <87fu9srj1p.fsf@gmx.de> 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:139853 Archived-At: --001a113d351874a71a055de27778 Content-Type: multipart/alternative; boundary="001a113d351874a716055de27776" --001a113d351874a716055de27776 Content-Type: text/plain; charset="UTF-8" Michael, you are completely right that my previous change was not necessary. I blame my prehistoric knowledge of Emacs here, as I wasn't aware of the change to use INSIDE_EMACS. On testing, it seems that EMACS=t just happened to work in bash (for legacy reasons, probably other dinosaurs like me), and INSIDE_EMACS also disables editing, and fixes my problem. You are also quite correct that INSIDE_EMACS was being set by tramp. The problem was that it was set at the wrong time: we need it set *before* we start the shell, to disable readline bracketed paste (and other advanced features) before we start, for example, interrogating the remote system for the running version with `uname` during `tramp-open-shell`. I have attached a patch that moves two variables, TERM and INSIDE_EMACS, out of `tramp-remote-process-environment`, and instead, handles setting them prior to shell execution. This has two advantages: First, INSIDE_EMACS is visible to the shell we are about to probe for usability, which fixes my own problem with bracketed paste support in libreadline / bash breaking, and which makes it uniformly available on the remote host. Second, changes to `tramp-terminal-type` (and the TRAMP version) are now handled correctly without having to recompute the value of `tramp-remote-process-environment`; previously this was not done, and a restart or user intervention would be required to correct them. Hopefully this meets with approval, so I append both the patch, and what I think is the appropriate changelog entry for this, to be manually added: 2017-11-13 Daniel Pittman * tramp-sh.el: Set TERM and INSIDE_EMACS environment earlier. (tramp-remote-process-environment): Remove TERM and INSIDE_EMACS. (tramp-remote-process-environment): Document their special handling. (tramp-open-shell): Set TERM and INSIDE_EMACS prior to starting the initial remote shell, so that it is also aware of the environment in which it is operating. --001a113d351874a716055de27776 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Michael, you are completely rig= ht that my previous change was not necessary.=C2=A0 I blame my prehistoric = knowledge of Emacs here, as I wasn't aware of the change to use INSIDE_= EMACS.=C2=A0 On testing, it seems that EMACS=3Dt just happened to work in b= ash (for legacy reasons, probably other dinosaurs like me), and INSIDE_EMAC= S also disables editing, and fixes my problem.

You are also quite correct that IN= SIDE_EMACS was being set by tramp.=C2=A0 The problem was that it was set at= the wrong time: we need it set *before* we start the shell, to disable rea= dline bracketed paste (and other advanced features) before we start, for ex= ample, interrogating the remote system for the running version with `uname`= during `tramp-open-shell`.

I have attached a patch that moves two variables, TER= M and INSIDE_EMACS, out of `tramp-remote-process-environment`, and instead,= handles setting them prior to shell execution.

This has two advantages:

First, INSIDE_= EMACS is visible to the shell we are about to probe for usability, which fi= xes my own problem with bracketed paste support in libreadline / bash break= ing, and which makes it uniformly available on the remote host.

Second, changes t= o `tramp-terminal-type` (and the TRAMP version) are now handled correctly w= ithout having to recompute the value of `tramp-remote-process-environment`;= previously this was not done, and a restart or user intervention would be = required to correct them.

Hopefully this meets with approval, so I append both th= e patch, and what I think is the appropriate changelog entry for this, to b= e manually added:

--001a113d351874a716055de27776-- --001a113d351874a71a055de27778 Content-Type: application/octet-stream; name="emacs-tramp-no-editing.patch" Content-Disposition: attachment; filename="emacs-tramp-no-editing.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_j9ylhay30 LS0tIDI2LjAuOTAvbGlzcC9uZXQvdHJhbXAtc2guZWwub3JpZwkyMDE3LTExLTEzIDEzOjU5OjI0 LjAwMDAwMDAwMCAtMDUwMAorKysgMjYu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