3.3.0: Possible regression in cygwin DLL (Win10); fixed in snapshot
Ken Brown
kbrown@cornell.edu
Sun Nov 7 22:20:46 GMT 2021
On 11/6/2021 11:46 PM, Takashi Yano wrote:
> On Sat, 6 Nov 2021 12:38:43 -0400
> Ken Brown wrote:
>> On 11/6/2021 7:42 AM, Corinna Vinschen wrote:
>>> On Nov 6 15:10, Takashi Yano wrote:
>>>> Ken Brown wrote:
>>>>> On 11/5/2021 3:41 PM, Takashi Yano via Cygwin wrote:
>>>>>> What about setting pipe mode to byte by default?
>>>>>
>>>>> I have a vague recollection that this caused some other problem, but I'll have
>>>>> to review the email discussions from a few months ago. I'm traveling at the
>>>>> moment and won't get to this for a few days.
>>
>> I found it:
>>
>> https://cygwin.com/pipermail/cygwin-developers/2021-August/012219.html
>
> Thanks!
>
> I tested the current pipe behaviour using the following test code.
> With both message and byte pipe, the result are the same:
> w:65536
> r:2048
> w:-1
> which complies with POSIX requirement.
> I have tested under Windows Vista, 7 and 10 and got same results.
Thanks. So maybe byte mode is OK after all.
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.
Ken
More information about the Cygwin-developers
mailing list