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 2025年8月16日 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
"i 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