From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from condef-06.nifty.com (condef-06.nifty.com [202.248.20.71]) by sourceware.org (Postfix) with ESMTPS id 02CDB3858D35 for ; Tue, 16 Nov 2021 14:43:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 02CDB3858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=nifty.ne.jp Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nifty.ne.jp Received: from conssluserg-04.nifty.com ([10.126.8.83])by condef-06.nifty.com with ESMTP id 1AGEeVbm008449 for ; Tue, 16 Nov 2021 23:40:31 +0900 Received: from Express5800-S70 (z221123.dynamic.ppp.asahi-net.or.jp [110.4.221.123]) (authenticated) by conssluserg-04.nifty.com with ESMTP id 1AGEZBmk023045 for ; Tue, 16 Nov 2021 23:35:11 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com 1AGEZBmk023045 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1637073311; bh=HSyiabLpSaGlzMcjZ+uJ4ncOIBnAi6PlcvKz0MyhPuU=; h=Date:From:To:Subject:In-Reply-To:References:From; b=19IBc82huPk8jfgVlWOU/aV0GerWBsT6Gk+0Ax7GHYipv5w6cVxDxpJ6Wj2vHLiv1 uikiyT3HbyCOlfhxAwTqOscPVNbxx4nwQid/l+K2m7fUMltkZnHBD+Lbxrp8tPFGop yng5tRY/mmVgFFqRA2YLglu1DsdHI/vZFfxAn4yX+O9eirgZgltBzeZF5KZYUwuyik HQGzqDdM9RSxPfIkxpQJhfepJITOqk6lOtayXjsSDcRqpNkNeJXai4r8WP88QnUHwT HhkApowHx93ljQQe0u7ImiPOVs1BQwQfaymfQ7hwut7BsrqHWJB/eLK62JJpnv9rlz +Vg/YVae8OJdA== X-Nifty-SrcIP: [110.4.221.123] Date: Tue, 16 Nov 2021 23:35:14 +0900 From: Takashi Yano To: cygwin-developers@cygwin.com Subject: Re: cygwin 3.3.x: another problem that may be related to pipes Message-Id: <20211116233514.8dee6c299f7a843c12d8010f@nifty.ne.jp> In-Reply-To: <20211116192015.444c2a8c386009b1275ab55f@nifty.ne.jp> References: <115203324.649908.1636923059546.ref@mail.yahoo.com> <115203324.649908.1636923059546@mail.yahoo.com> <20211115171811.844dce9cce2b4d13262d64f2@nifty.ne.jp> <20211115235021.0f0f64b1b0e2a7bd6d16be80@nifty.ne.jp> <9a7bdf86-0721-870f-b7ea-00d958967c98@cornell.edu> <20211116015239.57d5f981ffdb3196039258da@nifty.ne.jp> <3bf5793a-d9fe-6ca8-9812-d50fff3cffe9@cornell.edu> <20211116083544.88b6674b42deff69ba39db10@nifty.ne.jp> <7d27160f-9084-22f5-630e-34edb0cac5c6@cornell.edu> <20211116184515.c15092561825dc0180f667e0@nifty.ne.jp> <20211116192015.444c2a8c386009b1275ab55f@nifty.ne.jp> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin-developers@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component developers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Nov 2021 14:43:52 -0000 On Tue, 16 Nov 2021 19:20:15 +0900 Takashi Yano wrote: > 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. I have just submitted v3 patch. Please have a look. -- Takashi Yano