Re: [PATCH] Cygwin: pipe: Suppress unnecessary set_pipe_non_blocking() call.

2021-11-17 Thread Corinna Vinschen
On Nov 17 10:09, Ken Brown wrote:
> On 11/17/2021 3:08 AM, Takashi Yano wrote:
> > - Call set_pipe_non_blocking(false) only if the pipe will be really
> >inherited to non-cygwin process.
> 
> LGTM, but Corinna should probably take a quick look too, since I'm not very
> familiar with this part of the code.

Looks right to me.


Corinna


Re: [PATCH] Cygwin: pipe: Suppress unnecessary set_pipe_non_blocking() call.

2021-11-17 Thread Ken Brown

On 11/17/2021 3:08 AM, Takashi Yano wrote:

- Call set_pipe_non_blocking(false) only if the pipe will be really
   inherited to non-cygwin process.


LGTM, but Corinna should probably take a quick look too, since I'm not very 
familiar with this part of the code.


Ken


Re: [PATCH] Cygwin: Correct the release notes 3.3.3.

2021-11-17 Thread Corinna Vinschen
On Nov 17 17:09, Takashi Yano wrote:
> - Fix incorrect description of the bug fixes part.
> ---
>  winsup/cygwin/release/3.3.3 | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/winsup/cygwin/release/3.3.3 b/winsup/cygwin/release/3.3.3
> index 7248302a3..c947816db 100644
> --- a/winsup/cygwin/release/3.3.3
> +++ b/winsup/cygwin/release/3.3.3
> @@ -3,6 +3,10 @@ Bug Fixes
>  
>  - Fix issue that new pipe code doesn't handle reading zero byte reads
>emitted by some non-Cygwin apps.
> +  Addresses: https://cygwin.com/pipermail/cygwin/2021-November/249777.html
> +
> +- Fix issue that new pipe code doesn't handle size zero pipe which
> +  may be created by non-cygwin apps.
>Addresses: https://cygwin.com/pipermail/cygwin/2021-November/249844.html
>  
>  - Make sure that "X:" paths are not handled as absolute DOS paths in
> -- 
> 2.33.0

Obvious fix, just go ahead :)


Thanks,
Corinna


[PATCH] Cygwin: Correct the release notes 3.3.3.

2021-11-17 Thread Takashi Yano
- Fix incorrect description of the bug fixes part.
---
 winsup/cygwin/release/3.3.3 | 4 
 1 file changed, 4 insertions(+)

diff --git a/winsup/cygwin/release/3.3.3 b/winsup/cygwin/release/3.3.3
index 7248302a3..c947816db 100644
--- a/winsup/cygwin/release/3.3.3
+++ b/winsup/cygwin/release/3.3.3
@@ -3,6 +3,10 @@ Bug Fixes
 
 - Fix issue that new pipe code doesn't handle reading zero byte reads
   emitted by some non-Cygwin apps.
+  Addresses: https://cygwin.com/pipermail/cygwin/2021-November/249777.html
+
+- Fix issue that new pipe code doesn't handle size zero pipe which
+  may be created by non-cygwin apps.
   Addresses: https://cygwin.com/pipermail/cygwin/2021-November/249844.html
 
 - Make sure that "X:" paths are not handled as absolute DOS paths in
-- 
2.33.0



[PATCH] Cygwin: pipe: Suppress unnecessary set_pipe_non_blocking() call.

2021-11-17 Thread Takashi Yano
- Call set_pipe_non_blocking(false) only if the pipe will be really
  inherited to non-cygwin process.
---
 winsup/cygwin/spawn.cc | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 6b2026776..e160fa3bb 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -648,8 +648,9 @@ child_info_spawn::worker (const char *prog_arg, const char 
*const *argv,
 
   if (!iscygwin ())
{
+ int fd;
  cfd.rewind ();
- while (cfd.next () >= 0)
+ while ((fd = cfd.next ()) >= 0)
if (cfd->get_major () == DEV_PTYS_MAJOR)
  {
fhandler_pty_slave *ptys =
@@ -657,13 +658,15 @@ child_info_spawn::worker (const char *prog_arg, const 
char *const *argv,
ptys->create_invisible_console ();
ptys->setup_locale ();
  }
-   else if (cfd->get_dev () == FH_PIPEW)
+   else if (cfd->get_dev () == FH_PIPEW
+&& (fd == (in__stdout < 0 ? 1 : in__stdout) || fd == 2))
  {
fhandler_pipe *pipe = (fhandler_pipe *)(fhandler_base *) cfd;
pipe->close_query_handle ();
pipe->set_pipe_non_blocking (false);
  }
-   else if (cfd->get_dev () == FH_PIPER)
+   else if (cfd->get_dev () == FH_PIPER
+&& fd == (in__stdin < 0 ? 0 : in__stdin))
  {
fhandler_pipe *pipe = (fhandler_pipe *)(fhandler_base *) cfd;
pipe->set_pipe_non_blocking (false);
-- 
2.33.0