[PATCH v2] Cygwin: pipe: Restore blocking mode of read pipe on close()

Takashi Yano takashi.yano@nifty.ne.jp
Tue Sep 17 13:06:51 GMT 2024


On Thu, 12 Sep 2024 17:35:52 -0400
Ken Brown wrote:
> On 9/6/2024 4:08 AM, Takashi Yano wrote:
> > If a cygwin app is executed from a non-cygwin app and the cygwin
> > app exits, the read pipe remains in the non-blocking mode because
> > of the commit fc691d0246b9. Due to this behaviour, the non-cygwin
> > app cannot read the pipe correctly after that. Similarly, if a
> > non-cygwin app is executed from a cygwin app and the non-cygwin
> > app exits, the read pipe remains in the blocking mode. With this
> > patch, the blocking mode of the read pipe is stored into a variable
> > was_blocking_read_pipe on set_pipe_non_blocking() when the cygwin
> > app starts and restored on close(). In addition, the pipe mode is
> > set to non-blocking mode in raw_read() if the mode is blocking
> > mode as well.
> > 
> > Addresses: https://github.com/git-for-windows/git/issues/5115
> > Fixes: fc691d0246b9 ("Cygwin: pipe: Make sure to set read pipe non-blocking for cygwin apps.");
> > Reported-by: isaacag, Johannes Schindelin <Johannes.Schindelin@gmx.de>
> > Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
> > Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
> > ---
> >   winsup/cygwin/fhandler/pipe.cc          | 41 +++++++++++++++++++++++++
> >   winsup/cygwin/local_includes/fhandler.h |  3 ++
> >   winsup/cygwin/sigproc.cc                |  9 +-----
> >   3 files changed, 45 insertions(+), 8 deletions(-)
> 
> LGTM, but I haven't tried to test it (except to make sure that the 
> branch still builds).  I assume you've tested it.  My only question is 
> whether you want to mention the variable is_blocking_read_pipe in the 
> commit message.

Thanks for revewing!

I added the description for is_blocking_read_pipe to the commit message
and pushed.

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


More information about the Cygwin-patches mailing list