[PATCH v2 0/1] MR7998: server: Return proper value in member WriteQuotaAvailable.
Cygwin/MSYS2 in version 3.5.4 or later relies in having the WriteQuotaAvailable member of a NtQueryInformationFile(FilePipeLocalInformation) query properly filled. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57424 ``` A bisect of cygwin1.dll led to this commit: 49018bf5774fc90ddddc762a8462030c5d528643 is the first broken commit commit 49018bf5774fc90ddddc762a8462030c5d528643 Author: Takashi Yano <takashi.yano(a)nifty.ne.jp> Date: Mon Jul 1 17:44:53 2024 +0900 Cygwin: pty: Avoid client deadlock when pty master stops to read. ``` [cygwin commit cygwin-3_5-branch](https://www.cygwin.com/cgit/newlib-cygwin/commit/?h=cygwin-3_5-branch&id=490...) [cygwin commit main branch](https://www.cygwin.com/cgit/newlib-cygwin/commit/?id=c4fb5da2787693ea3bf20b2...) Installing cygwin/msys2 and reproducing this issue might need also the last patches from bug #55138 and #53574. -- v2: server: Improve returned value in member WriteQuotaAvailable. https://gitlab.winehq.org/wine/wine/-/merge_requests/7998
From: Bernhard Übelacker <bernhardu(a)mailbox.org> Cygwin/MSYS2 in version 3.5.4 or later relies in having the WriteQuotaAvailable member of a NtQueryInformationFile(FilePipeLocalInformation) filled with a non-zero value. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57424 --- dlls/ntdll/tests/pipe.c | 1 - server/named_pipe.c | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/tests/pipe.c b/dlls/ntdll/tests/pipe.c index cf98d555455..14a6148a2c5 100644 --- a/dlls/ntdll/tests/pipe.c +++ b/dlls/ntdll/tests/pipe.c @@ -2309,7 +2309,6 @@ static void test_pipe_local_info(HANDLE pipe, BOOL is_server, DWORD state) ok(local_info.ReadDataAvailable == 0, "ReadDataAvailable = %lu\n", local_info.ReadDataAvailable); ok(local_info.OutboundQuota == 200, "OutboundQuota = %lu\n", local_info.OutboundQuota); - todo_wine ok(local_info.WriteQuotaAvailable == (is_server ? 200 : 100), "WriteQuotaAvailable = %lu\n", local_info.WriteQuotaAvailable); ok(local_info.NamedPipeState == state, "%s NamedPipeState = %lu, expected %lu\n", diff --git a/server/named_pipe.c b/server/named_pipe.c index 6e4ae371a1b..62ab13724d3 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -854,10 +854,12 @@ static void pipe_end_get_file_info( struct fd *fd, obj_handle_t handle, unsigned pipe_info->ReadDataAvailable = pipe_end_get_avail( pipe_end ); pipe_info->OutboundQuota = pipe->outsize; - pipe_info->WriteQuotaAvailable = 0; /* FIXME */ pipe_info->NamedPipeState = pipe_end->state; pipe_info->NamedPipeEnd = pipe_end->obj.ops == &pipe_server_ops ? FILE_PIPE_SERVER_END : FILE_PIPE_CLIENT_END; + + pipe_info->WriteQuotaAvailable = pipe_info->NamedPipeEnd == FILE_PIPE_CLIENT_END + ? pipe_info->InboundQuota : pipe_info->OutboundQuota; /* FIXME */ break; } case FileStandardInformation: -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7998
v2: - leave the FIXME and retitle commit. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7998#note_102909
On Sat May 10 18:31:34 2025 +0000, Bernhard Übelacker wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/7998/diffs?diff_id=176653&start_sha=bf154b421aa3d4e4e9d8dc6face755e28b2c9db8#4dea89c85c6cea229e4fed705e9653112647e199_862_862) Hello Jinoh, thanks for looking into it. I experimented a little bit, but lost confidence this is going into the right direction. I have saved it in this [branch](https://gitlab.winehq.org/bernhardu/wine/-/commits/cygwin-WriteQuotaAvailabl...), is this remotely into the direction you described?
And because for getting msys2/cygwin further the "stub" variant is enough, I left the simple patch in this MR. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7998#note_102910
I think if you remove a `todo_wine`, but keep a `FIXME` for the implementation, a short comment about what there is still left to `FIX` about `ME` would be useful. Either that, or have another test that shows why `ME` still needs to be `FIX`ed. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7998#note_102930
participants (2)
-
Bernhard Übelacker -
William Horvath (@whrvt)