delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/02/02/14:02:05

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:in-reply-to
:references:mime-version:content-type:content-transfer-encoding;
q=dns; s=default; b=TYXPRg9mmt/+iDhnZXp7+xVsFVG/UeH7QdCWchr1bYm
Crc4hNSHvdw8+sOGHzzaS6nukhNrVtj3eoJfHXj3a9Ej5reaeYiqdCcnWRLXxBxn
3wWDidIgv/KGrqTgB9zlBSTi3WmB9+AKazh6JnWogJB3EnWMEX4kJ99n8G3xorFg
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:in-reply-to
:references:mime-version:content-type:content-transfer-encoding;
s=default; bh=I7hJMUY7/JmAXqbRf6pOY7p0bF4=; b=t0Yzld3s3YWugxz47
XTCCpZc7n3jXY5YMTzvmuJnqW5ufBczAUh/irnMMJ0wQ/DtXK8DOly7c8Dt4fZdz
7WjklWV2GOKdWttWKxGzLFnpLavF4dx+Y+lw6uFRDi44ls63aP3Cn3Jhltc2sy4n
G9wB2cDHSo/0ePl3sVrM/ikLj0=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-4.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=apps, capability
X-HELO: conssluserg-02.nifty.com
DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 012J0S9P030908
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1580670029; bh=JzKwevpzATxBZzIXRqo2e7osP5LUSO8oQeyGc8sLKsc=; h=Date:From:To:Subject:In-Reply-To:References:From; b=qic/J03kyO2TX9mFtYpfoPOSsDn2TJRfoaapZomLkl43CCUtLSPLTwoJtJP+dq6Yw BOMilk47e8KGeafxVtchBWXnv18TUmRm4Yh6pCU9a6Izzdhn9mcOb+uWLQrfXGnBJC g7yKg8L1hmo7nFVkC6C0UH0h3eaNuKTSbkmgscaGrRTRCT5G6zTpnrjkG14Plf7eGw nBzj1YqQO+a/vamPzSzJspwUBoZPBDQpjLIgvGpvcJbJnuAdtdP28yt4ZAVuouKMwZ QQ1ceq6KFNTiqwnSJSMvg1Wc/Zbp6Eqxi5uKseSh7BxowA+RgkSmynJZeKt3CfgyCn oz7R2n0edEMNA==
Date: Mon, 3 Feb 2020 04:00:33 +0900
From: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
To: cygwin AT cygwin DOT com
Subject: Re: 3.1.x: Mangled input/output when calling non-cygwin programs
Message-Id: <20200203040033.375b2b75be4ab5b8b12b82bb@nifty.ne.jp>
In-Reply-To: <04b7abc1-3317-51c2-99e2-c8573458a5f1@googlemail.com>
References: <7e3d947e-b178-30a3-589f-b48e6003fbb3 AT googlemail DOT com> <20200202185909 DOT a3b3f8627438177e18171de3 AT nifty DOT ne DOT jp> <04b7abc1-3317-51c2-99e2-c8573458a5f1 AT googlemail DOT com>
Mime-Version: 1.0
X-IsSubscribed: yes

On Sun, 2 Feb 2020 13:18:03 +0100
m0viefreak wrote:
> On 02.02.2020 10:59, Takashi Yano wrote:
> >> 4) Importance of TERM: When connecting to my Cygwin installation using
> >>    SSH using Putty, TERM=putty-256color is set. When executing non-
> >>    native program from that session using that TERM, output is broken
> >>    even worse than in 1), and also keybindings are broken. I need to
> >>    force TERM=xterm-256color for those invocations.
> >>    Shouldn't this be handled transparently and enforced automatically by
> >>    the pcon code?
> > 
> > Which keybinding is broken? In my environment, arrow keys and function
> > keys work as expected in cmd.exe and windows-native vim.
> 
> HOME/END keys were broken if the native app brought up an interactive
> prompt.

In my environment, HOME/END keys are working as expected in cmd.exe
and windows-native vim in putty even if TERM=putty-256color.

I guess Maven changes its behaviour depending on TERM.

> It seems that the cygwin1.dll does not care about TERM, but if a
> non-native application *uses* TERM for whatever reason things start to
> break. If indeed 'cygwin' is the right terminfo to be used, should the
> PTY code then somehow set TERM=cygwin in the non-native process? But
> what if the none-native program doesn't even know the 'cygwin' terminfo?

This make sens only if apps use TERM *right way*. In other words,
if apps uses TERM in the manner of termcap or terminfo. I don't
think Maven does that.

Now I am looking into jansi library which Maven uses, and found
it sets IS_CYGWIN flag according to TERM environmen. It seems
that IS_CYGWIN is set to false if TERM=cygwin. In this case,
jansi uses SetConsoleTextAttribute() call to set text color
rather than escape sequences such as ESC[31m. Ohterwise, escape
sequence is used.

See:
https://github.com/fusesource/jansi/blob/master/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java

New cygwin provide pure windows console for native apps, so
escape sequence is not handled correctly. This is the cause
of the problem 1) and 2). It may be a problem that TERM is
set even though pure windows console does not have the
capability which TERM environment declares. For the one
thought, it can make sense to unset TERM before execute
native-console apps. However, this does not solve the issue
of Maven. If Maven (jansi) handles TERM *correctly*, this
can be a solution.

> One more thing (maybe also related): When calling a non-native program
> that prints very sinle long line (e.g. just 'mvn' without args) that
> wraps around the terminal, and then copying that multi-line output from
> mintty, the result differs:
> - disable_pcon: A single line is copied
> - default: Multiple lines are copied (like in block selection mode)

This is because pseudo console insert "\r\n" at the each wrapped
point. This is the internal bhaviour of pseudo console, so we
cannot control it.

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019