[PATCH v2 0/4] Improve pseudo console support.

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Jan 22 12:20:57 GMT 2021

Hi Takashi,

On Jan 22 05:58, Takashi Yano via Cygwin-patches wrote:
> The new implementation of pseudo console support by commit bb428520
> provides the important advantages, while there also has been several
> disadvantages compared to the previous implementation.
> These patches overturn some of them.
> The disadvantage:
>  1) The cygwin program which calls console API directly does not work.
> is supposed to be able to be overcome as well, however, I am not sure
> it is worth enough. This will need a lot of hooks for console APIs.
> Takashi Yano (4):
>   Cygwin: pty: Inherit typeahead data between two input pipes.
>   Cygwin: pty: Keep code page between non-cygwin apps.
>   Cygwin: pty: Make apps using console APIs be able to debug with gdb.
>   Cygwin: pty: Allow multiple apps to enable pseudo console
>     simultaneously.
>  winsup/cygwin/fhandler.h      |  15 +-
>  winsup/cygwin/fhandler_tty.cc | 805 ++++++++++++++++++++++++++--------
>  winsup/cygwin/spawn.cc        | 102 +++--
>  winsup/cygwin/tty.cc          |  11 +-
>  winsup/cygwin/tty.h           |  18 +-
>  5 files changed, 730 insertions(+), 221 deletions(-)
> -- 
> 2.30.0

I found a problem with this patchset.

Try this:

  Start mintty

  $ touch foo
  $ attrib +r foo
  $ gdb /bin/rm
  $ start foo

  At this point, starting rm will take a few seconds.  While GDB is
  still working on this, *before* GDB returns to the prompt, type some
  keys on keyboard, e. g., "1234".

Without this patchset, you'll see the keys being echoed in mintty, and
as soon as GDB returns to the prompt, the keys are copied to GDBs input
buffer and the keys you typed show up after the prompt.  This is the
expected behaviour.

  (gdb) 1234

With this patchset, the keys are *not* echoed in mintty, and as soon
as the GDB prompt returns, the keys are still not visible.

Now continue the execution of rm:

  (gdb) c
  /usr/bin/rm: remove write-protected regular file 'foo'? 

Without this patchset, I get

  /usr/bin/rm: error closing file
  [Inferior 1 (process 1224) exited with code 01]

That's not optimal, apparently.  With this patchset:

  (gdb) c
  /usr/bin/rm: remove write-protected regular file 'foo'? 1234

so the keys typed while gdb was starting rm have been saved up and then
used as input for rm.  That's not quite right either, is it?


More information about the Cygwin-patches mailing list