delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/08/16/12:33:15

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 57GGXFri3474514
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 57GGXFri3474514
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=vu+u1E6Y
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 223923858CB6
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1755361993;
bh=6POQKJTo+lDweJ/iSaPG6PiK3pNA9coIqNj8GYa7HJo=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=vu+u1E6YNS9/13z3tCgS0atrCugOW8cnWhGuWFGKdnjPcTO5T5KrxvVininpQ+/j3
Qyy5eh4HbVmNIOO8MVmMqquN3FM1Q/pxkDqGRd7B7aiqECBpxRUCZcIkcBWTGiS5KZ
8ZB/MV3KlvtiRjHpikMC+Z+bDV2/4ayB5Juyfmqc=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A0E6D3858D1E
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A0E6D3858D1E
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1755361936; cv=none;
b=QiOAVTvYEGa5XCkPy1IYtZqXd0n0w6aibGsyhrHIqxgDFNeWuW5Fty+mn+rUglYADXE5CX5lNuID33DkHyizi9y+pj3MCGF4IP8EV3cuUfb+qY6s/55LzjP2z+9U2LS1u8M/20cp0Huc/Q8Sf6AoVvR/C+6C32D975KeqTiKr7U=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1755361936; c=relaxed/simple;
bh=PFmvNhVf+NFdG6+w7YCbJP7v9vtA4dnTvvjH51GO6co=;
h=Message-ID:Date:MIME-Version:From:Subject:To:DKIM-Signature;
b=oeqK3LaV0U4cEPMLSgfGe6e0V23ZyZjgDTwWlKnwAIVnXPvxPN6ivWQFTGjGa1rIKd6e5zfreRaJfL3Dz0/7+jaJQpFxtwMx5hnxvymYznbGiJKz/5+pUKu1ZbBoQBLOSkKl3ifuyubec0kTPY7xuWbmdgtBc7hsY/nZicTKwhQ=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0E6D3858D1E
Message-ID: <f69f6b8d-c7b6-452e-aaef-17b473f64df6@SystematicSW.ab.ca>
Date: Sat, 16 Aug 2025 10:32:12 -0600
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: pty/terminfo dependency when running WSL
To: cygwin AT cygwin DOT com
References: <c76d21bf-7b9d-4f1c-803d-47d17a61cb7f AT towo DOT net>
<20250816214543 DOT 812a2376dcc088fc86f07b02 AT nifty DOT ne DOT jp>
<fe580b91-4fbd-46cc-963f-c0a40f7a458a AT towo DOT net>
Organization: Systematic Software
In-Reply-To: <fe580b91-4fbd-46cc-963f-c0a40f7a458a@towo.net>
X-Stat-Signature: ufhzu8utmxzm9hia86kimrhhtjbdk9ym
X-Rspamd-Server: rspamout05
X-Rspamd-Queue-Id: 8535F20026
X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361
X-Session-ID: U2FsdGVkX1/EjhHCI7KueOO1K/4f6fbRK156qCblnsY=
X-HE-Tag: 1755361933-512037
X-HE-Meta: U2FsdGVkX1+BK1LbTMzxzZ/J08BnzbYZbBQe+NWOrupZv36DB7i9AmCWiVtMCI6B8I5J3p9HDVzi6lNbY5rdZeqszd/8/cXhYI8H6I686JzkHPB0iIenPH8bf9BZ9E+OoDuS0EogdAIaNPp2ET8GUqLQXtj5qeJmVsB+mtxflKMaYTjFQxb4YXhadvIAlNIzbOkRHrQZOBL1vxj80ngL+IFmzI8I6JMlMSJbgT5EBW91DANw8W7x2eRP5J7s+isBOap/y/SItfYcz1Bdw8kPNNNCZXE8wnIEO3zgczuUF+Cp8E4DY87Tpw/TlmBK8GX6bRQLuklcC2tGxGNHkKCt2mmUJAsqSXeepN7AUpaobBIcN24loWg3Vpo/MxmHXllArUkcpqXhu5wKrdSCMX/KBbqC/NcQyjE+f/dpBL/1qa+yFFSUM5oAZQ==
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Brian Inglis <Brian DOT Inglis AT SystematicSW DOT ab DOT ca>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 57GGXFri3474514

On 2025-08-16 07:29, Thomas Wolff via Cygwin wrote:
> Hi Takashi,
> thanks for the background...
> 
> Am 16.08.2025 um 14:45 schrieb Takashi Yano via Cygwin:
>> Hi Thomas,
>>
>> On Sat, 16 Aug 2025 13:22:35 +0200
>> Thomas Wolff wrote:
>>> There is an weird interworking issue when launching WSL from a minimal
>>> standalone installation of cygwin.
>>> (It can be reproced with a full installation, though, see below).
>>> When calling Windows-native wsl.exe, as implicitly done via mintty
>>> --WSL, and there is no terminfo database installed, something fails
>>> about pty setup, and the WSL shell will be run in pty-less mode (no
>>> prompt, no stty signal handling, ^C terminates the shell). When terminfo
>>> is present, everything works as expected.
>>> Test case:
>>> remove /usr/share/terminfo/78/$TERM (xterm or xterm-256color, or the
>>> whole subdirectory, or the 6d or 76 subdirectories when using
>>> TERM=mintty* or vt settings), i.e. move it to some saving place.
>>> Run mintty --WSL, observe the issue described above.
>>> Interestingly, cygwin shells are not affected by the issue, so some
>>> obscure interworking of the dreadful Windows ConPTY layer or so might
>>> contribute to the issue, but in any case I doubt that the presence of
>>> terminfo should affect the effective pty behaviour.
>> ConPTY assumes xterm sequences unconditionally and use CSI 6n at the
>> startup. If the terminal does not support CSI 6n and no responce from
>> the terminal, CreatePseudoConsole() hangs. So pty checks terminfo to
>> determine whethter ConPTY can be used.
>>
>> If the terminal does not support CSI 6n, pty does not use ConPTY for
>> non-cygwin app like WSL. In this case, the stdin/stdout is just a
>> pipe for WSL, so shell does not shows prompt. However, the shell
>> itself is running, so the command should be accepted. Please try
>> to type ls, ps and so on.
>>
>> I understand the behaviour of cygwin1.dll should not depends on
>> the terminal aspects, however, ConPTY forcibly uses xterm sequences.
>> So this is a desperate measure.
> The drawback is that standalone packages that use a terminal also have to bundle 
> terminfo or will run into mysterious failure. I have solved this for my wsltty 
> package now but maybe an even more tricky approach could further optimise the 
> scenarios: If pty does not find terminfo, it could try to propagate CSI6n to the 
> host and only after a timeout switch to pipe mode. Just an idea.

If mintty does not find terminfo, could it invoke conpty in legacy winpty mode?

$ regtool list -v /proc/registry/HKEY_CURRENT_USER/Console/ | grep ForceV2
ForceV2 (REG_DWORD) = 0x00000001 (1)
					0 = legacy winpty console
					1 = updated conpty console

	https://learn.microsoft.com/en-gb/windows/console/legacymode

"ⓘ Note
This setting is globally applied to all sessions that start after the preference 
is changed. Sessions that are already open will not be changed."

So it looks like the reg entry could be saved, and if terminfo is not found, 
restored after the console session is active.

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher  but when there is no more to cut
                                 -- Antoine de Saint-Exupéry


[It is a valid for any Cygwin package to assume that any and all Base packages 
are available and installed without checking:

	alternatives base-cygwin base-files bash coreutils crypto-policies
	cygutils cygwin dash diffutils editrights file findutils gawk getent
	grep gzip hostname info ipc-utils libreadline7 libreadline8 libssl1.1
	libssl3 login man-db mintty ncurses openssl rebase run sed tar terminfo
	tzdata util-linux vim-minimal which _autorebase

Those that provide their own infrastructure may have to check for their 
pre-existence or else install them!

	https://cygwin.com/packages/x86_64/terminfo/terminfo-6.5+20240427-1

Luckily Base terminfo entries are only ~400KB, a lot less if you filter them, 
but don't forget the /usr/lib/terminfo->../share/terminfo symlink, and the 
tabset files, if you include those terminfo entries!

I could be persuaded to produce a terminfo-wsltty or some such package, if that 
might help, and you provided the filter criteria?]


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

- Raw text -


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