DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 57GCkvl63397840
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 57GCkvl63397840
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=yY7LS9EL
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D5C03858D33
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1755348415;
	bh=bQqjUPLYVPDt3Wmg5jK8rS1O5FfgQa76caclxXlQyP8=;
	h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=yY7LS9ELh1IEI4E7gfl5Pyn9hWZSsGnv8Lbz+xTsebUQ2/qMy1w+s7SOQ1Zph1oIf
	 4PCK79Qjs+1VFhVCFVnlXvQukuVixWiFQqQZthEWqvgWy6Nm3pVAyOoszN3jQSxsxC
	 QEbPagxzyyVhmwqvIsFLfcwcfFVTR8UBLHktOyOA=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC3C73858C5E
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EC3C73858C5E
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1755348347; cv=none;
 b=tKTcmRG6+HIs8tEFIr7GWJ1gzGX3E6rcO7omRL22KOWATgdTHByBF6OasIMEnLggevpI9qG5xreMcot+jreIF6bsR7+byMfHC7Tvbmb4t3T7nqoVrQIzfN79g0AaymQuBb8cO8+ruJrrSTGOLDbzKk9ZBypqiQEs52HK7kSAD+0=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1755348347; c=relaxed/simple;
 bh=Bilagr59G3ItlRR07uzTVxUicCjnpYTryCopwqIC4/I=;
 h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature;
 b=dyLs+F5CnuCK283h/0IsyHqMH2xJGX5Hvw7fjw+9PhP6WySJhAzbhoZzfDQTSuGneZB6UkpDdKPI3wrCktUQdi4rdycoOtrKKDG5+9BJ/VFzPBvIdKr5LGY69tCMmyySwyQNmbieanqk/Fe0Vwy8DRdb0bMPqw3HkVhWHXO3tsY=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC3C73858C5E
Date: Sat, 16 Aug 2025 21:45:43 +0900
To: cygwin@cygwin.com
Subject: Re: pty/terminfo dependency when running WSL
Message-Id: <20250816214543.812a2376dcc088fc86f07b02@nifty.ne.jp>
In-Reply-To: <c76d21bf-7b9d-4f1c-803d-47d17a61cb7f@towo.net>
References: <c76d21bf-7b9d-4f1c-803d-47d17a61cb7f@towo.net>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Takashi Yano via Cygwin <cygwin@cygwin.com>
Reply-To: Takashi Yano <takashi.yano@nifty.ne.jp>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces~archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>

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.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

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