Hi Takashi,

On Mar 31 22:27, Takashi Yano wrote:
> Native (non-cygwin) ninja creates pipe with size == 0, and starts
> cygwin process with that pipe. This causes infinite loop in the
> fhandler_fifo_pipe::raw_write(). Ideally, the pipe implementation
> in cygwin could work even with pipe size == 0, however, it seems
> impossible due to:
> 
> (1) select() does not work for that pipe because PeekNamedPipe()
>     always returns 0. Read side is ready to read only when the
>     write side is about to write, but there is no way to know that.
> (2) The cause of the problem:
>     https://cygwin.com/pipermail/cygwin/2025-January/257143.html
>     cannot be avoidable. To avoid CancelIo() problem, the patch
>     https://cygwin.com/pipermail/cygwin-patches/2025q1/013451.html
>     restricts the data size less than the current pipe space.
>     However, if pipe size is zero this is impossible.
> 
> This patch adds just a workaround for native ninja that avoid
> infinite loop in raw_write().
> [...]
> @@ -670,7 +670,9 @@ pipe_data_available (int fd, fhandler_base *fh, HANDLE h, 
> int mode)
>                          fpli.WriteQuotaAvailable);
>         return fpli.WriteQuotaAvailable;
>       }
> -      /* TODO: Buffer really full or non-Cygwin reader? */
> +      return PIPE_BUF; /* Workaround for native ninja. Native ninja creates
> +                       pipe with size == 0, and starts cygwin process
> +                       with that pipe. */

Funny that this problem cleared up this TODO entry :)))

Please push.


Thanks,
Corinna

Reply via email to