X-Recipient: archive-cygwin@delorie.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=uJ/ZmfYsBaM2gOZ0ZAqXZ7TNeoHUWT0zikTayGVdC/4
	cfoTvbAnCP6dG0AqApKgXDk6RWGClJSQrHVAf4O6kFcvfFQReUvP04bxqV+INuS6
	05iKKBpHyPIc8lcNyrdOjwhHYqBTRJQ8Riz8/DXEGz+1Iw0y6+EENPuOO1avVKoI
	=
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=KesQ5PIuC2uCwvp2e2Tjot2G4B0=; b=mTRv/naOkB/9qae0k
	844gGn/vKN4cD+TfEohZ4YUkQkhS2lFOrYQtqorq0Nvm34Ld5v+9mVCpM5NfOQ7e
	5dblrzSJbs5VNvJN84V+VlI+aYHzdFm3ejVRQ6pK0POV75w5k2W1W32M0Klu/ZvV
	UaI/t9LbQx6w0/VZ9vMHw/8WV8=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=m0viefreak, xterm, terminfo
X-HELO: conssluserg-06.nifty.com
DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com 0129wueM005566
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp;	s=dec2015msa; t=1580637536;	bh=YJq0aZEsP4MKpgXSm2EPCwOFMPwrTdmf7egsWoPwYKY=;	h=Date:From:To:Subject:In-Reply-To:References:From;	b=lnP1X3iZuicAezUiRNje8Ji/r+LUEli0u0j1g0lCT8aLH/r+jCli3ySmYitbjcAMq	 glIprNA+WzH5PwO9+GOnf1mrEQe580t3/Y8BKwg/2LIB23PBd3Lu3oQ4hmSeUTq829	 PePU45U+788OGy5JXuYhKqBeZbZp4rcLAwCgfQryJZ54wSlqxHgqlfgI6WDUZMwJF1	 EeyOyftzueZjaVoE6SRWW+ALeY/4H2NGddj0lBWyV2OS6bLk5TwLE9Yn3lOlPvvbhE	 DbeMth7lZs/FLRHFpS0MK17kQo4jwZNY77Qyh3R64Ex1bcwsj5kcp3YGvJ8BHdL2Pf	 SV6VOlC4AwscQ==
Date: Sun, 2 Feb 2020 18:59:09 +0900
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: 3.1.x: Mangled input/output when calling non-cygwin programs
Message-Id: <20200202185909.a3b3f8627438177e18171de3@nifty.ne.jp>
In-Reply-To: <7e3d947e-b178-30a3-589f-b48e6003fbb3@googlemail.com>
References: <7e3d947e-b178-30a3-589f-b48e6003fbb3@googlemail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

On Sat, 1 Feb 2020 19:00:04 +0100
m0viefreak wrote:
> Since Cygwin 3.1's pseudo console support was introduced I've run into
> lots of issues with non-cygwin programs.

Thanks for the report.

> 1) Mangled output: See screenshot [1].
>    As you can see, at what it seems random places, the output is broken.
>    The above can easily be reproduced using Apache Maven in any project,
>    e.g. using a sample project created using [2].
> 
> 2) Terminal width: For some reason, non-native programs do not use the
>    full width of the terminal (Mintty and TERM=xterm-256color). Can also
>    be seen in [1] (blue highlight) and reproduced e.g. using Maven with
>    a relatively small window.

I looked into this problem, but Maven is something weird.
I don't think it uses termcap or terminfo, but it behaves
differently depending on TERM.

If you run
env TERM=cygwin mvn <something>
in mintty, problem 1) and 2) does not occur.

> 3) Typed characters while non-cygwin program is running are lost.
>    Usually, when typing characters while a native program executes,
>    which does *not* read from standard input, after the program exits,
>    all these typed characters are put into the prompt.
>    When executing a non-native program, such as, again, "mvn clean",
>    which does not read from stdin, typed characters are completely lost.
>    This is very frustrating, since I am often quicker at tying the
>    next command, while the previous command is still doing something.

I know the cause of this problem. Let me consider.

> 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. 

My configuration of putty is:
Terminal
   + Keybord
        + The Function keys and keypad: Xterm R6

The PTY codes do not reffer to TERM environment, so cygwin1.dll itself
should not behave differently depending on TERM.

-- 
Takashi Yano <takashi.yano@nifty.ne.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

