delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/02/09/09:56:31

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=JGVueoeQMT7XrgGzJI+0msbTctUOs34W7vqR6kA9v3UeFl0sDOzZY
vSlaAoYRm9jHqcMpO71i3L+102ix6GOksxAaWgPkjQ0YKyEDnjx8jCq9lE2aPsvI
Aq55aq81mJZjt9yaYIars8MPWpY+MWfAnjuhR0JGqrTUcvwxpXk1fc=
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=+rjX/DBOnTrT3orwiihD3Ijaqjg=; b=QPuDUwCE8k3Q6/RezrY/P7GzoX6O
JB1tVNvYs2BxMj7wj5wEeqojpt/h9AUuQBve5S1I9buIXbwuKs0AZS5uaFwq3kk7
zTiIaW+tqyykbsGibulDBodKP5p+kOT+pAL3XJt0vhPWbHsHtd57Q5QupcJsPGyY
XZEspbTlc2ZY0BI=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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=Hx-languages-length:1509
X-HELO: mout.kundenserver.de
Date: Sat, 9 Feb 2019 15:51:22 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: Tom Honermann <thomas DOT honermann AT synopsys DOT com>
Cc: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>,
Cameron Gunnin <cameron DOT gunnin AT synopsys DOT com>,
Marc-Andre Laverdiere <marc-andre DOT laverdiere AT synopsys DOT com>
Subject: Re: fcntl with O_APPEND fails to force append mode on stderr for native Windows programs
Message-ID: <20190209145122.GY13951@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: Tom Honermann <thomas DOT honermann AT synopsys DOT com>, "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>, Cameron Gunnin <cameron DOT gunnin AT synopsys DOT com>, Marc-Andre Laverdiere <marc-andre DOT laverdiere AT synopsys DOT com>
References: <9E5DE55D2546134DACFE4D3C117B36FDAD0CEE1D AT us01wembx1 DOT internal DOT synopsys DOT com>
MIME-Version: 1.0
In-Reply-To: <9E5DE55D2546134DACFE4D3C117B36FDAD0CEE1D@us01wembx1.internal.synopsys.com>
User-Agent: Mutt/1.10.1 (2018-07-13)

--v+Mbu5iuT/5Blw/K
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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:
>=20
> $ ./test | cat
> $ cat out
> The syntax of this command is:
>=20
> NET
>     [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP |
>       HELPMSG | LOCALGROUP | PAUSE | SESSION | SHARE | START |
>       STATISTICS | STOP | TIME | USE | USER | VIEW ]
>=20
> 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=3D0be0b8=
f0335e

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.


Thanks,
Corinna

--=20
Corinna Vinschen
Cygwin Maintainer

--v+Mbu5iuT/5Blw/K
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlxe6OoACgkQ9TYGna5E
T6Do2BAAhCJJpGYSnrxJXf9chehl0JIZIkCifvtlK8zRJGEUHdHHRAWgQVrnbHQV
SPy1Gh+SoUBFwBeSOLjtBE8umI3nWvdYqvRTZytLs/aHpXcOz/ZNiIJ9MvZ/VUOC
NoD0Gt/QC7DSZ+L/GCoIPPwxOn0zLuD8xkAzzEMEoF2nlDG9lzOTHqYlvODiC5Dz
0xlPMKU4likkHCxcqYwDV06S/+VrKLGf5ljddSUcr7MWuWYysl6OTfYVptGvQ67M
mSY+jd7uF8DP6ZGKacctR1OSRwrv4Ur91DA+msPWxRB7Ccqh1aO7XmGxvUMJ2XKZ
yG6uxQEJiqCW1/iubdce+4jxFHI2mR43JvW2WlSLslyRTAz40hTql98duNGfSVo4
+K+NvX3ply3J6U+6usmCuU3YByfHX/x+8t4vNtpDth8y+nTJ3Eye1dfc2GXy4O7T
cDT6MLHCE1+CZC+/dE3ol8h76bbZ37X78dD5lLNoYC4h43ndMBk2HAmqbD9/6Ko3
W4ublNynBy5O3LsYStOmMEgHwj+5o09/WR9eKI6R/S4u7G4XkaETE0m1pJdiLTcq
KOqt8ziNJebXVtOvJycDty3RiJfaKmrJdfGGOEh0fwtnbDmZ0sv5eqBe3PpeZ9Wi
Ta8//ikEA3n5H4gxVmxYudrt1a6VKzT74g6qkrYTVeTLzBW9J6w=
=AGTj
-----END PGP SIGNATURE-----

--v+Mbu5iuT/5Blw/K--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019