Question on pseudo console and legacy console

Koichi Murase myoga.murase@gmail.com
Sun Feb 9 03:20:00 GMT 2020


Thank you for the explanation.  I think I'm going to by default add
`disable_pcon' to the environment variable `CYGWIN' before calling
`posix_openpt'.

2020年2月9日(日) 7:43 Takashi Yano
> Do you mean "without pseudo console support" by "legacy console mode"?

Yes.

> If so, pty should behave as before 3.1.0 if you set disable_pcon,

I see. Actually I was particularly interested in whether the
introduction of the pseudo console support is related to solving any
existing problems before 3.1.0 or not.

> except that char code conversion, from code page which you set, to
> char code which is declared by locale, is still enabled.

I haven't recognized this change. This is really nice!

> With out pseudo console, for example:
> 1) cmd.exe echos command twice.
> 2) dir /p does not work in cmd.exe.
> 3) Many of windows native console apps such as windows native gnuplot
>    does not work at all.

OK, there are in fact functional differences between the pseudo
console mode and the legacy console mode.  So, is the purpose of the
introduction of the pseudo console mode is not just to enhance the
Cygwin console but to make Windows Command-Line applications work
properly in all Cygwin terminals including terminal emulators as well
as console?

Now I understand the difficulties of the pseudo console modes.  This
is really challenging as Windows Console API and ANSI/VT terminal
sequences are independent ecosystems and based on different models.
I'm not sure if it is even possible to make it realize in a completely
transparent way for both types (Windows and Cygwin) of applications.

> > * If the console mode would not cause any differences when there
> >   is no visible console window, would it make sense to change
> >   Cygwin's behavior so that it switches to the pseudo console mode
> >   only when the console window is present (if it is not too
> >   difficult technically)?
>
> I am not sure what you mean "the console window is present", but

I am sorry I did not put it clearly.  By "the console window is
present", I meant the case that a console will be allocated for the
terminal emulator but the corresponding GUI console window will not be
shown in the foreground.  My suggestion was to choose/switch a mode
for each PTY session but not for each program.

Specifically I thought about completely disabling the pseudo console
support with terminal emulators, and turning on it only for Cygwin
consoles.  But this is based on my assumption that the pseudo console
mode is aimed to provide enhanced Cygwin consoles and does not affect
the functional differences in terminal emulators.

----

Nevertheless, IMHO, the current implementation of the pseudo console
mode is better to be turned off for terminal emulators by default and
only turned on for Cygwin consoles.  Of course, it can still
optionally be turned on in terminal emulators when the user or the
terminal emulator explicitly request that.

The TTY/PTY mechanism should be transparent to the types of terminals,
but the current implementation of PTY by the pseudo console mode
requires a specific set of terminal capabilities and does not allow
any extensions which is not in the pseudo console.  This is not a good
design as a basic system API.  If this pseudo console mode is
defaulted for Cygwin PTY, that means any terminal emulator cannot be
implemented properly on Cygwin except the case that the terminal
emulator is a perfect copy of the pseudo console.

In fact there are already many reports caused by the behavior
difference of the pseudo console from an expected one.  I don't think
this kind of troubles stops by just modifying the superficial behavior
of the current implementation.  We want to avoid supporting new
features (Windows Command-Line applications) by breaking many existing
applications which opens PTY.  I think it is better to wait until we
could find a way to make the PTY behavior transparent to the terminal
types.

----

Thank you,

Koichi

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



More information about the Cygwin mailing list