From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84955 invoked by alias); 12 Mar 2016 19:39:50 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 84917 invoked by uid 89); 12 Mar 2016 19:39:49 -0000 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 Received: from ipbcc0d020.dynamic.kabel-deutschland.de (HELO calimero.vinschen.de) (188.192.208.32) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 12 Mar 2016 19:39:48 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 31BDEA806A2; Sat, 12 Mar 2016 20:39:46 +0100 (CET) Date: Sat, 12 Mar 2016 19:39:00 -0000 From: Corinna Vinschen 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: <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) X-SW-Source: 2016-03/txt/msg00187.txt.bz2 --FkmkrVfFsRoUs1wW Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1117 On Mar 11 16:05, Kaz Kylheku wrote: > We can reproduce the problem with just file streams using > a much simpler program: >=20 > #include >=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" Content-length: 819 -----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--