public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin-developers@cygwin.com
Subject: Re: cygwin 3.3.x: another problem that may be related to pipes
Date: Tue, 16 Nov 2021 19:20:15 +0900	[thread overview]
Message-ID: <20211116192015.444c2a8c386009b1275ab55f@nifty.ne.jp> (raw)
In-Reply-To: <20211116184515.c15092561825dc0180f667e0@nifty.ne.jp>

On Tue, 16 Nov 2021 18:45:15 +0900
Takashi Yano wrote:
> Hi Ken,
> 
> I noticed the following while fixing this issue.
> 
> We now noticed that NtWriteFile() may return STATUS_PENDING
> even in nonblocking mode.
> 
> If NtWriteFile() returns STATUS_PENDING in nonblocking mode,
> does not the following 'if' block in raw_write() refer to 
> uninitialized io.Information?
> 
>       while (len1 > 0)
>         {
>           status = NtWriteFile (get_handle (), evt, NULL, NULL, &io,
>                                 (PVOID) ptr, len1, NULL, NULL);
>           if (evt || !NT_SUCCESS (status) || io.Information > 0
>               || len <= PIPE_BUF)
>             break;
>           len1 >>= 1;
>         }
> 
> 'evt' is false if we are in nonblocking mode.
> '!NT_SUCCESS(status)' is false if status == STATUS_PENDING.
> Then io.Information would be referred I think.
> 
> Isn't this another bug in raw_write()?
> 
> What should we do in this case? Should we do like:
> 
>           if (evt || !NT_SUCCESS (status) || status == STATUS_PENDING
>               || io.Information > 0 || len <= PIPE_BUF)
> 
> ?

Answer to myself.

I think moving cygwait(evt, ...) before this 'if' block is the
right thing.

Right? If so, I will submit v3 patch.

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

  reply	other threads:[~2021-11-16 10:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <115203324.649908.1636923059546.ref@mail.yahoo.com>
     [not found] ` <115203324.649908.1636923059546@mail.yahoo.com>
     [not found]   ` <20211115171811.844dce9cce2b4d13262d64f2@nifty.ne.jp>
2021-11-15 13:01     ` Corinna Vinschen
2021-11-15 13:57       ` Ken Brown
2021-11-15 14:36         ` Takashi Yano
2021-11-15 15:11           ` Takashi Yano
2021-11-15 15:27             ` Ken Brown
2021-11-15 15:36               ` Ken Brown
2021-11-15 16:45                 ` Takashi Yano
2021-11-15 16:25           ` Corinna Vinschen
2021-11-15 14:50       ` Takashi Yano
2021-11-15 16:08         ` Corinna Vinschen
2021-11-15 16:37           ` Ken Brown
2021-11-15 16:52             ` Takashi Yano
2021-11-15 18:47               ` Ken Brown
2021-11-15 23:35                 ` Takashi Yano
2021-11-15 23:49                   ` Ken Brown
2021-11-16  3:28                     ` Takashi Yano
2021-11-16  9:28                       ` Corinna Vinschen
2021-11-16  9:45                     ` Takashi Yano
2021-11-16 10:20                       ` Takashi Yano [this message]
2021-11-16 14:35                         ` Takashi Yano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211116192015.444c2a8c386009b1275ab55f@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin-developers@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).