interworking issue with native Windows, depending on terminfo

Takashi Yano takashi.yano@nifty.ne.jp
Sun Nov 15 13:40:28 GMT 2026


On Thu, 12 Nov 2026 23:34:43 -0600
Brian Inglis wrote:
> On 2026-11-11 04:14, Takashi Yano wrote:
> > Hi Brian,
> > 
> > On Tue, 10 Nov 2026 13:54:24 -0600
> > Brian Inglis wrote:
> >> On 2026-10-29 05:38, Takashi Yano wrote:
> >>> On Thu, 29 Oct 2026 11:27:00 +0100
> >>> Thomas Wolff wrote:
> >>>> Hi Takashi,
> >>>>
> >>>> Am 29.10.2026 um 03:10 schrieb Takashi Yano:
> >>>>> Hi Thomas,
> >>>>>
> >>>>> On Tue, 27 Oct 2026 11:32:13 +0100
> >>>>> Thomas Wolff wrote:
> >>>>>> Hi,
> >>>>>> please see
> >>>>>> https://github.com/microsoft/WSL/issues/42032#issuecomment-6432254350
> >>>>>> "cygwin is not providing the native process a proper console when the
> >>>>>> matching terminfo is missing".
> >>>>>>
> >>>>>> If terminfo is not present (e.g. /usr/share/terminfo/78/xterm, or
> >>>>>> xterm-new, or xterm-256color, whichever is set via $TERM), and you run
> >>>>>> wsl.exe, the WSL shell will be in non-interactive/non-pty mode, not show
> >>>>>> a prompt, not handle signals (so, e.g. ^C would exit WSL), etc.
> >>>>>> One use case would be a standalone application with cygwin bundled but
> >>>>>> not terminfo.
> >>>>>> While a standalone package developer will notice this and eventually
> >>>>>> also provide terminfo files, I don't see a logic connection that would
> >>>>>> make pty/console or whatever is missing here depend on terminfo.
> >>>>> wsl.exe needs ConPTY to work. ConPTY needs ESC sequences that are
> >>>>> supported by xterm, vt100, etc.
> >>>>>
> >>>>> So cygwin1.dll checks whether the terminal has that capabilities using
> >>>>> terminfo, and if not, does not start ConPTY. In this case, the native
> >>>>> programs run in normal cygwin pty, which is just pipes for the native
> >>>>> programs. This is because wsl does not think it is running in terminal.
> >>>> I see the point. Could there be an explicit exception (skipping the
> >>>> terminfo check) for $TERM values in
> >>>> xterm*
> >>>> vt[1-4]*
> >>>> vt5[0-9][0-9]*
> >>>> ansi
> >>>> rxvt*
> >>>> screen*
> >>>> gnome*
> >>>> konsole*
> >>>> mlterm*
> >>
> >> Base terminfo term types for historical reasons, see:
> >>
> >> https://cygwin.com/cgit/cygwin-packages/ncurses/tree/ncurses.cygport#n284
> >>
> >>> I’m considering disabling terminfo lookups and relying solely on
> >>> checking the CSI 6n response (with a timeout).
> >>
> >> If you do that, could I suggest rather than CPR, Send Primary Device Attributes:
> > 
> > Thanks for the advice. The reason why PTY code checks existence
> > of CPR is that the pseudo console reqires it to work.
> > 
> > Pseudo console privided by OpenConsole.exe indeed uses the
> > 'CSI c', but normal pseudo console does not. Therefore, pseudo
> > console can work under the terminal which does not support CSI c.
> > 
> >> <https://invisible-mirror.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-c:Ps-=-0-or-omitted.2226>
> >>
> >> Request		^[[c		
> >> Response	^[[?64;2;3;4;6;9;11;15;21;28;29;1;22c
> >> 		    v	    decoding		   v
> >> type features		VT420pRSeNThrlwc
> >> 			v    expand    v
> >> VT420 printer Regis Sixel erase NRC 11? TechC horiz rect loc wide colour
> > 
> > I'm not sure which entry you suggested to be checked for pseudo
> > cosnole to work. Any idea?
> 
> If the pty only uses CPR esc seq, then that is the correct check; however if it 
> also uses other features, you have to decide whether to pre-check some other 
> response(s), or just use each esc seq?

Pseudo console use many ESC sequences, however, CPR is the most critical
one. If the terminal does not respond to SCI6n, an attempt to start a
non-cygwin app will hang while waiting for CPR response. For other ESC
sequences, the terminal output may be garbled, but at least the app does
not hang.

> >> Suggest 10-50ms timeout should be enough depending on speed and load.
> > 
> > Currently, PTY code calls Sleep(1) up to 100 times unless CPR
> > is returned. It may be too long.
> 
> For script queries, I use bash:
> 
> 	read -d $char -N $cols -p $'\E['"$params$char" -s -t $timeout
> 
> with timeout < 1 and found 0.250 works okay from bash under mintty, but anything 
> lower gives garbled responses, so you may want to keep any timeout larger than 
> my original suggestion, but YMMV, as nominally the pty runs 3Mbaud.

Thanks I'll verify the response time on my side once again.

> 
> >>> It does not seem natural for a POSIX emulation layer to refer to
> >>> terminfo.
> >>
> >> Agreed!
> -- 
> 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


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


More information about the Cygwin-developers mailing list