Debian Bug report logs - #913237
xterm: exec-formatted sends an ending bracketed-paste sequence to the application (when enabled)

version graph

Package: xterm; Maintainer for xterm is Debian X Strike Force <[email protected]>; Source for xterm is src:xterm (PTS, buildd, popcon).

Reported by: Vincent Lefevre <[email protected]>

Date: Thu, 8 Nov 2018 15:54:01 UTC

Severity: normal

Tags: patch, upstream

Found in version xterm/337-1

Fixed in version xterm/338-1

Done: Sven Joachim <[email protected]>

Bug is archived. No further changes may be made.

Full log


Message #36 received at [email protected] (full text, mbox, reply):

Received: (at 913237) by bugs.debian.org; 5 Dec 2018 02:51:10 +0000
From [email protected] Wed Dec 05 02:51:10 2018
X-Spam-Checker-Version: SpamAssassin 3.4.2-bugs.debian.org_2005_01_02
	(2018-09-13) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-18.6 required=4.0 tests=BAYES_00,FVGT_m_MULTI_ODD,
	HAS_BUG_NUMBER,HEADER_FROM_DIFFERENT_DOMAINS,PGPSIGNATURE,
	RCVD_IN_DNSWL_LOW,SPF_PASS,TXREP autolearn=ham autolearn_force=no
	version=3.4.2-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 42; hammy, 150; neutral, 167; spammy,
	0. spammytokens: hammytokens:0.000-+--H*UA:2014-03-12,
	0.000-+--H*u:2014-03-12, 0.000-+--H*UA:1.5.23, 0.000-+--H*u:1.5.23,
	0.000-+--H*ct:protocol
Return-path: <[email protected]>
Received: from smtp-1.his.com ([216.194.195.13])
	by buxtehude.debian.org with esmtp (Exim 4.89)
	(envelope-from <[email protected]>)
	id 1gUNHH-0007e0-2m
	for [email protected]; Wed, 05 Dec 2018 02:51:10 +0000
Received: from localhost (localhost [127.0.0.1])
	by smtp-1.his.com (Postfix) with ESMTP id E830C60E61
	for <[email protected]>; Tue,  4 Dec 2018 21:51:05 -0500 (EST)
X-Virus-Scanned: Debian amavisd-new at smtp-1.his.com
Received: from smtp-1.his.com ([127.0.0.1])
	by localhost (smtp-1.his.com [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id M6+BZF2NgRDh for <[email protected]>;
	Tue,  4 Dec 2018 21:51:00 -0500 (EST)
Received: from smtp-nf-201.his.com (smtp-nf-201.his.com [216.194.196.93])
	by smtp-1.his.com (Postfix) with ESMTP id 7CDD660E50
	for <[email protected]>; Tue,  4 Dec 2018 21:51:00 -0500 (EST)
Received: from cuda201.his.com (cuda201.his.com [216.194.196.22])
	by smtp-nf-201.his.com (Postfix) with ESMTPS id E4068606C7
	for <[email protected]>; Tue,  4 Dec 2018 21:29:51 -0500 (EST)
X-ASG-Debug-ID: 1543978253-061c4129b4cc4bf0001-7x0Zhs
Received: from smtp-nf-202.his.com (smtp-nf-202.his.com [216.194.196.20]) by cuda201.his.com with ESMTP id y4P8eF8iuRne2FYt; Tue, 04 Dec 2018 21:50:53 -0500 (EST)
X-Barracuda-Envelope-From: [email protected]
X-Barracuda-RBL-Trusted-Forwarder: 216.194.196.20
Received: from zproxy101.his.com (zproxy101.his.com [18.218.2.49])
	by smtp-nf-202.his.com (Postfix) with ESMTPS id E87E8600BE;
	Tue,  4 Dec 2018 21:50:48 -0500 (EST)
Received: from localhost (localhost.localdomain [127.0.0.1])
	by zproxy101.his.com (Postfix) with ESMTP id 970601A045D;
	Tue,  4 Dec 2018 21:50:48 -0500 (EST)
X-Barracuda-RBL-IP: 18.218.2.49
X-Barracuda-Effective-Source-IP: zproxy101.his.com[18.218.2.49]
X-Barracuda-Apparent-Source-IP: 18.218.2.49
Received: from zproxy101.his.com ([127.0.0.1])
	by localhost (zproxy101.his.com [127.0.0.1]) (amavisd-new, port 10032)
	with ESMTP id wMEB-N-byv31; Tue,  4 Dec 2018 21:50:48 -0500 (EST)
Received: from localhost (localhost.localdomain [127.0.0.1])
	by zproxy101.his.com (Postfix) with ESMTP id 7E45E1A0462;
	Tue,  4 Dec 2018 21:50:48 -0500 (EST)
X-Virus-Scanned: amavisd-new at 
Received: from zproxy101.his.com ([127.0.0.1])
	by localhost (zproxy101.his.com [127.0.0.1]) (amavisd-new, port 10026)
	with ESMTP id 7Qbh7pA5wYOm; Tue,  4 Dec 2018 21:50:48 -0500 (EST)
Received: from prl-debian8-64.jexium-island.net (static-71-246-219-82.washdc.fios.verizon.net [71.246.219.82])
	by zproxy101.his.com (Postfix) with ESMTPSA id 619ED1A045D;
	Tue,  4 Dec 2018 21:50:48 -0500 (EST)
Received: from tom by prl-debian8-64.jexium-island.net with local (Exim 4.84_2)
	(envelope-from <[email protected]>)
	id 1gUNGx-0005ze-Vo; Tue, 04 Dec 2018 21:50:47 -0500
Date: Tue, 4 Dec 2018 21:50:47 -0500
From: Thomas Dickey <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: Re: Bug#913237: xterm: exec-formatted yields a tilde character in
 zsh and emacs
Message-ID: <[email protected]>
X-ASG-Orig-Subj: Re: Bug#913237: xterm: exec-formatted yields a tilde character in
 zsh and emacs
Reply-To: [email protected]
References: <[email protected]>
 <[email protected]>
 <[email protected]>
 <[email protected]>
 <[email protected]>
 <[email protected]>
 <[email protected]>
 <[email protected]>
 <[email protected]>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="ReaqsoxgOBHFXBhH"
Content-Disposition: inline
In-Reply-To: <[email protected]>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Barracuda-Connect: smtp-nf-202.his.com[216.194.196.20]
X-Barracuda-Start-Time: 1543978253
X-Barracuda-URL: https://spam.his.com:443/cgi-mod/mark.cgi
X-Virus-Scanned: by bsmtpd at his.com
X-Barracuda-Scan-Msg-Size: 4342
X-Barracuda-BRTS-Status: 1
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=
X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.63077
	Rule breakdown below
	 pts rule name              description
	---- ---------------------- --------------------------------------------------
[Message part 1 (text/plain, inline)]
On Tue, Nov 27, 2018 at 09:56:15AM +0100, Vincent Lefevre wrote:
> On 2018-11-26 20:38:37 -0500, Thomas Dickey wrote:
> > On Sun, Nov 25, 2018 at 12:08:03AM +0100, Vincent Lefevre wrote:
> > > With zsh, one can reproduce the issue with:
> > > 
> > > $ xterm -e zsh -f
> > 
> > If you added a "-l" option, that would turn on xterm's logging feature
> > 
> > 	xterm -l -e zsh -f
> > 
> > which could be interesting.
> 
> Here's what the log file gives (output with hd):
> 
> 00000000  1b 5b 31 6d 1b 5b 37 6d  25 1b 5b 32 37 6d 1b 5b  |.[1m.[7m%.[27m.[|
> 00000010  31 6d 1b 5b 6d 20 20 20  20 20 20 20 20 20 20 20  |1m.[m           |
> 00000020  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
> *
> 00000060  20 20 20 20 0d 20 0d 0d  1b 5b 6d 1b 5b 32 37 6d  |    . ...[m.[27m|
> 00000070  1b 5b 32 34 6d 1b 5b 4a  7a 69 72 61 25 20 1b 5b  |.[24m.[Jzira% .[|
> 00000080  4b 1b 5b 3f 32 30 30 34  68 62 08 62 69 6e 64 6b  |K.[?2004hb.bindk|
> 00000090  65 79 20 2d 65 1b 5b 3f  32 30 30 34 6c 0d 0d 0a  |ey -e.[?2004l...|
> 000000a0  1b 5b 31 6d 1b 5b 37 6d  25 1b 5b 32 37 6d 1b 5b  |.[1m.[7m%.[27m.[|
> 000000b0  31 6d 1b 5b 6d 20 20 20  20 20 20 20 20 20 20 20  |1m.[m           |
> 000000c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
> *
> 00000100  20 20 20 20 0d 20 0d 0d  1b 5b 6d 1b 5b 32 37 6d  |    . ...[m.[27m|
> 00000110  1b 5b 32 34 6d 1b 5b 4a  7a 69 72 61 25 20 1b 5b  |.[24m.[Jzira% .[|
> 00000120  4b 1b 5b 3f 32 30 30 34  68 07 7e                 |K.[?2004h.~|
> 0000012b
> 
> The 07 7e is what the exec-formatted generates (the Ctrl-G doesn't
> seem to have any effect in zsh).

exec-formatted doesn't send a ^G, it simply does an execvp() for the arguments.

The escape "[?2004h" is turning on bracketed paste (which I asked about).
 
> If after "binkey -e", I type "echo '" then Ctrl-V, I get:
> 
> 00000120  4b 1b 5b 3f 32 30 30 34  68 65 08 65 63 68 6f 20  |K.[?2004he.echo |
> 00000130  27 1b 5b 37 6d 5e 5b 1b  5b 32 37 6d 5b 32 30 31  |'.[7m^[.[27m[201|
> 00000140  7e                                                |~|
> 
> So, actually, the effect of exec-formatted is more complex than just
> a tilde (or Ctrl-G tilde).
> 
> > But the bug report deals with programs run from xterm, which the
> > shell wouldn't see -- unless it's reading xterm's output in some
> > way.
> 
> The shell sees the tilde, as if it were entered with the keyboard.

The shell is using bracketed paste, and is reading xterm's output,
as I suggested.
 
> Note that I can replace
> 
>   exec-formatted("browser %s", PRIMARY)
> 
> by
> 
>   exec-formatted("/bin/true", PRIMARY)
> 
> and I get the same behavior in xterm, i.e. the command doesn't matter.

so pasting works fairly consistently :-)
 
> > > then in the xterm:
> > > 
> > > zira% bindkey -e
> > 
> > Perhaps "zira%" is your shell prompt.
> 
> Yes, the hostname follwed by "%" is the default zsh prompt.
> 
> > What does "bindkey -e" have to do with exec-formatted?
> 
> "bindkey -e" selects Emacs editing mode. It just makes the issue
> visible. But with the "echo '" + Ctrl-V test, the same issue is
> reproducible without needing "bindkey -e":
> 
> 00000000  1b 5b 31 6d 1b 5b 37 6d  25 1b 5b 32 37 6d 1b 5b  |.[1m.[7m%.[27m.[|
> 00000010  31 6d 1b 5b 6d 20 20 20  20 20 20 20 20 20 20 20  |1m.[m           |
> 00000020  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
> *
> 00000060  20 20 20 20 0d 20 0d 0d  1b 5b 6d 1b 5b 32 37 6d  |    . ...[m.[27m|
> 00000070  1b 5b 32 34 6d 1b 5b 4a  7a 69 72 61 25 20 1b 5b  |.[24m.[Jzira% .[|
> 00000080  4b 1b 5b 3f 32 30 30 34  68 65 08 65 63 68 6f 20  |K.[?2004he.echo |
> 00000090  27 5e 08 1b 5b 37 6d 5e  1b 5b 37 6d 5b 1b 5b 32  |'^..[7m^.[7m[.[2|
> 000000a0  37 6d 5b 32 30 31 7e                              |7m[201~|
> 000000a7

That looks as expected, if you've got two different things writing to
the terminal at the same time:

https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Bracketed-Paste-Mode

but the execvp command by itself doesn't do the writing

> The effect of exec-formatted is what appears after "27 5e 08".

-- 
Thomas E. Dickey <[email protected]>
https://invisible-island.net
ftp://ftp.invisible-island.net
[signature.asc (application/pgp-signature, inline)]

Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Fri Nov 15 00:22:17 2024; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.