https://bugs.winehq.org/show_bug.cgi?id=43036
--- Comment #1 from dan-wine@berrange.com --- Investigating the code I've learnt that the '_pipe' function calls "CreatePipe". This method then uses NtCreateNamedPipeFile() to create the HANDLE for the read end of the pipe, passing GENERIC_READ for the access control bits, while using NtOpenFile() to create the HANDLE for the write end of the pipe, passing GENERIC_WRITE for the access control bits.
Next, the SetNamedPipeHandleState() method ultimately ends up calling set_named_pipe_info() in the wineserver. This method calls get_pipe_server_obj() passing FILE_WRITE_ATTRIBUTES for the required access control bits.
Since the read end of the pipe was opened with GENERIC_READ, get_pipe_server_obj() fails with ERROR_ACCESS_DENIED. So the read end of the pipe created by CreatePipe() will never be able to have attributes set.
Interestingly, when we call SetNamedPipeHandleState() with the write end of the pipe, the get_pipe_server_obj() fails because the handle is not actually a pipe, causing set_named_pipe_info() to fall back to get_handle_obj() passing 0 as the required access control check. Thus, even though the write end of the pipe has GENERIC_WRITE permissions (which include FILE_WRITE_ATTRIBUTES), this never gets checked !
I'm unclear on what the best way to fix all this is, but as a test I modified CreatePipe to set FILE_WRITE_ATTRIBUTES for the read pipe and that was sufficient to fix GNULIB (and libvirt) when running under Wine.