3.3.0: Possible regression in cygwin DLL (Win10); fixed in snapshot

Takashi Yano takashi.yano@nifty.ne.jp
Mon Nov 8 08:23:14 GMT 2021


On Sun, 7 Nov 2021 17:20:46 -0500
Ken Brown wrote:
> In the meantime I found the commit that changed the default from byte mode to 
> message mode:
> 
> commit 31d2bedc585420092eb53895c5f5646651f13215
> Author: Christopher Faylor <me@cgf.cx>
> Date:   Sun Oct 23 19:01:47 2011 +0000
> 
>      * fhandler_tty.cc (fhandler_pty_slave::read): Use consistent way for testing
>      ReadFile return.
>      * pipe.cc (fhandler_pipe::create_selectable): Open the write side of the pipe
>      in message-mode to force writing as "chunks".  Explain why.
> 
> [...]
> --- a/winsup/cygwin/pipe.cc
> +++ b/winsup/cygwin/pipe.cc
> @@ -238,9 +238,15 @@ fhandler_pipe::create_selectable (LPSECURITY_ATTRIBUTES 
> sa_ptr, HANDLE& r,
> [...]
> +        Note that the write side of the pipe is opened as PIPE_TYPE_MESSAGE.
> +        This *seems* to more closely mimic Linux pipe behavior and is
> +        definitely required for pty handling since fhandler_pty_master
> +        writes to the pipe in chunks, terminated by newline when CANON mode
> +        is specified.  */
>         r = CreateNamedPipe (pipename, PIPE_ACCESS_INBOUND | overlapped,
> -                          PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, 1, psize,
> +                          PIPE_TYPE_MESSAGE | PIPE_READMODE_BYTE, 1, psize,
>                             psize, NMPWAIT_USE_DEFAULT_WAIT, sa_ptr);
> 
>         if (r != INVALID_HANDLE_VALUE)
> 
> I also found discussion on the mailing list on the same day as this commit in 
> which cgf referred to fixing a bug (that *I* reported, coincidentally):
> 
>    https://cygwin.com/pipermail/cygwin/2011-October/197953.html
> 
> I'll try to test more thoroughly tomorrow, but a quick test seems to show that 
> the STC I submitted in connection with that bug report now succeeds even with 
> CYGWIN=pipe_byte.

The STC attached to that post is checking pty behaviour. Currently,
the named pipe for pty is always configured as message type regardless
of CYGWIN=pipe_byte.

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


More information about the Cygwin-developers mailing list