X-Recipient: archive-cygwin@delorie.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:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; q=dns; s=
	default; b=DLOCc64+VMoy9+zjO15QBhKFMo/IMFEcwBMUk5kfBRsdVfQHmGR0o
	7w4O3jS3BucBj+amiQgDl+JsFFI4MoNK+JgCDD4/gQ17V+2pzv028qpKIS5aOsWL
	bVZExhdnk8/05VeCuzsOX8v92wdh8I7TZyUskHS/cKLFDnbuHC9CiM=
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:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; s=default;
	 bh=4qB1SCqXgGRj2FBkCsrirAbQf5Y=; b=UiFL9w4FjAVRUEcpCBjrWk0Waszx
	pOp8Rd0izZH5CgkG22WrJdFJx0nlIAC9BUVDuBXsYy6S/73RHTTH033AxeH5eyOv
	UjLw4BGbh/UzkhDhlj9p4+XCW4Hr65UWgaJcPIrItDmC9sXcnWPdmsTHsjidVI+g
	beQt29piLNldQCQ=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-96.6 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC,USER_IN_WHITELIST autolearn=no version=3.3.2 spammy=H*i:sk:11ca145, H*f:sk:11ca145, Hx-languages-length:1091, HX-Envelope-From:sk:corinna
X-HELO: calimero.vinschen.de
Date: Sat, 12 Mar 2016 20:39:46 +0100
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Problem with line buffering and getc function on 1.7.33.
Message-ID: <20160312193946.GB3567@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <a0c23290b3a8502552dcf149fbfa5f90@mail.kylheku.com> <56E34346.9010000@gmail.com> <11ca145175d5b7d15db927c0c1f28b18@mail.kylheku.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;	protocol="application/pgp-signature"; boundary="FkmkrVfFsRoUs1wW"
Content-Disposition: inline
In-Reply-To: <11ca145175d5b7d15db927c0c1f28b18@mail.kylheku.com>
User-Agent: Mutt/1.5.24 (2015-08-30)

--FkmkrVfFsRoUs1wW
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mar 11 16:05, Kaz Kylheku wrote:
> We can reproduce the problem with just file streams using
> a much simpler program:
>=20
> #include <stdio.h>
>=20
> int main(void)
> {
>   FILE *out =3D fopen("file", "w+");
>   setvbuf(out, (char *) NULL, _IOLBF, 0);
>   getc(out);
>   clearerr(out);
>   fseek(out, 0, SEEK_SET);
>   putc('a', out);
>   putc('b', out);
>   putc('c', out);
>   putc('d', out);
>   putc('e', out);
>   putc('\n', out);
>   fclose(out);
>   return 0;
> }
>=20
> The contents of file end up being "\n": one empty
> line, instead of "abcde\n":
>=20
>   $ cat file
>=20
>   $

Thanks for the testcase.  I can reproduce the issue and I see where the
problem occurs, but I'm still puzzled.  Comparing the code in our newlib
C library with its BSD counterparts, I could swear the same behaviour
happens on OpenBSD as well.  If not (which needs testing), I wonder why
and where newlib's actually different.  Right now I don't see the
difference.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--FkmkrVfFsRoUs1wW
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJW5HCCAAoJEPU2Bp2uRE+gQEMP/RoKdKl+706qBh/ov/vNTdre
ovV/wYmCCoBUvhK5ndR6yNpYrEUaqnEVk8oDOnHYAbGmQJf/n+UN83ZuRapatGfy
jbKqMh1HvBTNwN12v3nPKsdkuXglWin1oSs6s9jSfY1ovdk7RMBr8RIIlWxlBrcy
IT+AUmwt0uhYHt8s90aCKSacnaYup6lePVsNxZtzZ5dnBOj8TL6W/SIDcRVXOm4l
Wlh/sCBMNTwD/97MkJIiUYPf/y2JspHX3w39srLYrmt4A1u1/bAh2+mY/pFR9U0v
qgbQScPyu7W9ofwqo8Hp2018dTtBfXwOzZ+NpTY8hBy22Hvsqx58DWeju96qJOyR
YInJtggIbUyCFZyZBATkEluT5kyeTSVR+TcGa1B4B8g1EceY9AfQB3MjYywCt3Iy
rk2+qjNnIyPX65k/kzVJF4AgaiOm60S4OKDNcJ1tUn6NbQyQxQ9lhFp7yI8gMc1J
jzCNYXJq/QLv57+VS1ZcS3I3PKmrZrblZn2C5wGrgO8iXS3XYE8F9x/mBzhEo+u6
f0xxmHyqxxAhd/IHIOySgaY1caE/f2JhHvgRay+NuUsmpYKY7v0fZheYM2804ioI
Q+CuT2ucg/CoQEGvtDtonIdKrorw6bzBCIj8RsJmKX7EjgrS/jlUKVx/xPEaXWMT
zMRL5SXGe/PwYdxfmOdC
=al7D
-----END PGP SIGNATURE-----

--FkmkrVfFsRoUs1wW--
