X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=biLJ0mUBDE5inVOBv7ntTfz4qlqc3yGi0GLMEdiUoN4LXyYtaDEPU hjimStHdVyeyleZpUr3zz0Hn5YCIg+TZ4dUZIunY9bNo5MmdlmwUr1XLGlH1WaBb dOC4CJ0QVp01Bhbt+s+FQbCDQDQZ58tN9QXSccWt7DcUhk1xxmfoAE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=yNI8hGF8U1+0UQjYX74cVVdbix4=; b=Gt1TH7NdBycQToQ4rvbqBNqMk8Gf swS+qCRMVbcjWqwsKLZ6IIQgiE6BX6Gp8erBDIjGEn1Ie6yBx0Rbosb13pDDKPa/ +QZvSKRyWBThTbwQVfBERxUTEnlCwdGxNc38BZSw2TLdn14lu7x8SPuV34rGPCvh emxF8a0MsigJ4E0= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-100.9 required=5.0 tests=BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=uploaded, extensive X-HELO: mout.kundenserver.de Date: Sun, 10 Feb 2019 10:32:45 +0100 From: Corinna Vinschen To: Tom Honermann Cc: "cygwin AT cygwin DOT com" , Cameron Gunnin , Marc-Andre Laverdiere Subject: Re: fcntl with O_APPEND fails to force append mode on stderr for native Windows programs Message-ID: <20190210093245.GA13951@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: Tom Honermann , "cygwin AT cygwin DOT com" , Cameron Gunnin , Marc-Andre Laverdiere References: <9E5DE55D2546134DACFE4D3C117B36FDAD0CEE1D AT us01wembx1 DOT internal DOT synopsys DOT com> <20190209145122 DOT GY13951 AT calimero DOT vinschen DOT de> <9E5DE55D2546134DACFE4D3C117B36FDAD0CF450 AT us01wembx1 DOT internal DOT synopsys DOT com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2/Dpz40iF3jpiHxF" Content-Disposition: inline In-Reply-To: <9E5DE55D2546134DACFE4D3C117B36FDAD0CF450@us01wembx1.internal.synopsys.com> User-Agent: Mutt/1.10.1 (2018-07-13) --2/Dpz40iF3jpiHxF Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Feb 9 15:33, Tom Honermann wrote: > On 2/9/2019 9:51 AM, Corinna Vinschen wrote: > > On Feb 8 22:25, Tom Honermann wrote: > >> The following program demonstrates the problem. > >> [...] > >> Here is where things go bananas. If the program is run with stdout > >> initially redirected to a pipe, then the stderr output from the native > >> Windows program ends up overwriting the stdout output from the two > >> calls to echo: > >> > >> $ ./test | cat > >> $ cat out > >> The syntax of this command is: > >> > >> NET > >> [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP | > >> HELPMSG | LOCALGROUP | PAUSE | SESSION | SHARE | START | > >> STATISTICS | STOP | TIME | USE | USER | VIEW ] > >> > >> Note that the lines containing "first" and "second" are now absent in > >> the file. > > Thanks for the testcase. I tracked this down to a bug when calling > > native (non-Cygwin) apps. If the descriptor is in O_APPEND mode, we > > have to set the file offset to EOF before calling native apps. However, > > this only worked reliably for the first descriptor in O_APPEND mode, but > > only by chance for subsequent descriptors in O_APPEND mode. Your > > example code with the extra pipe to `cat' triggered the misbehaviour. > > > > I fixed that in git master: > > https://sourceware.org/git/?p=3Dnewlib-cygwin.git;a=3Dcommitdiff;h=3D0b= e0b8f0335e > > > > This will be in the 3.0.0 release. > > > > I just uploaded new developer snapshots to https://cygwin.com/snapshots/ > > You only need to replace the Cygwin DLL for testing. Please give it a = try. >=20 > Thank you, Corinna! This does appear to fix the problem. I verified > the snapshot with the original test case and the one above and both work > as expected now. We'll do some more extensive testing and report back > if we find any further issues. You are awesome! Thanks for testing. I'll upload another 3.0.0 test release early next week and then I hope the release can be done a few days later. Corinna --=20 Corinna Vinschen Cygwin Maintainer --2/Dpz40iF3jpiHxF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlxf770ACgkQ9TYGna5E T6BjyA/9EzQ0v3I+Dh4s0pVmvULZvIdP2Coj5KIa4GAIdT16iGoSSRqwO4X0dBvQ 6U/M5/H1h7o5kkuk7sjzmmLxvE7hpjit42rIOYxFUDlGorB5b/3wGixPMKaoSlI/ i2rb97zp5hgqQPRRO/H+NqUTomRw0yn0rDTll+tREOJXAnLSshGn2cshpzOz1Ed0 woV/MkdXwgZP7ClNKfk+TfC8O7oYB5zQLBvt9DymnV5cZMwdr5LrT5/cJQYjx41D OKoe5e6TjKpd5gG0q5fLxmCvKZxe3OG8iycNdrGlIhb25uN/FO4S+6dPUQPVhkv/ usuzk6w8F4wjWsHA/CTdwgXm5BrZd+w85avjAWsgZCHR/3+yPGmwr5nZ5K30VMYU c8LSAdya4LWNekavPzoOpIGSpvK43YdefhGVbgwFNCb+rwXpoIG2Ny+Goly1VBrv c81DmSWa0ylXWunLBGLy48XPY62bCdV80bXG3nXh9sZS0vq+IZALgXdA3SyJrn8b 8Awd22mIfVxQl0LCnJCg4uK+wGtYmxTyN3xUd/Rm8AlFuG1CoxAPwv51mz49kc1e Kyg/O0CsU9njYc0Bg7bTRFKHHR10RwIKm1Aj4WAMR8cFvY7ijawmdC+/mHq6M/x5 p/eJ9euXDbUXxEH5UhVcda44sf0tYCQLFEt9qpUdBvt2BjnqfIM= =e5G8 -----END PGP SIGNATURE----- --2/Dpz40iF3jpiHxF--