| delorie.com/archives/browse.cgi | search |
| 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:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; q=dns; s= | |
| default; b=Qx/T/pPH1YJwT08YipqAYVzxzTxqq1DFGS79WQ3k7fLYF2Q7WYnoI | |
| cF1H/seyyTeMCXgQdUrbiz3hFwaUVLwFxt4FqzkOK6FOBXL1hQ8EVaFmxImJ4SlR | |
| ZFhhKDqx/MXvfX8jNHuXNk9O/EQkWeEki835mcmBTOaqznquazZvQo= | |
| 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=VPzVfTAedEJPQb2CpvfjiN5ndmc=; b=H7Ddbiw9aCRPyBNDtGl5M45hHKiZ | |
| dTNCsMbBArY0VVGtmyAvqZ9twb4YAwpO4R2i2zovjj075WFSUP8WTlgXjCPx7NQ4 | |
| NjVBh3RgGdaveOAcFOlpxx9p5NliflQjMvacWBlPd0HLk55TORM8eu5aIg0NrYUy | |
| Fqk3t807sZOgAQI= | |
| 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-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=-94.7 required=5.0 tests=BAYES_40,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC,USER_IN_WHITELIST autolearn=no version=3.3.2 spammy=liberty, H*f:sk:11ca145, swear, newlibs |
| X-HELO: | calimero.vinschen.de |
| Date: | Sat, 12 Mar 2016 23:29:21 +0100 |
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Problem with line buffering and getc function on 1.7.33. |
| Message-ID: | <20160312222921.GD3567@calimero.vinschen.de> |
| Reply-To: | cygwin AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| References: | <a0c23290b3a8502552dcf149fbfa5f90 AT mail DOT kylheku DOT com> <56E34346 DOT 9010000 AT gmail DOT com> <11ca145175d5b7d15db927c0c1f28b18 AT mail DOT kylheku DOT com> <20160312193946 DOT GB3567 AT calimero DOT vinschen DOT de> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <20160312193946.GB3567@calimero.vinschen.de> |
| User-Agent: | Mutt/1.5.24 (2015-08-30) |
--cHMo6Wbp1wrKhbfi
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Mar 12 20:39, Corinna Vinschen wrote:
> 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
> > $
>=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.
I do now. Basically it's setvbuf screwing up the internal flags in the
FILE structure. I took the liberty to update newlib's setvbuf to the
OpenBSD version locally and I'm going to apply my patches to newlib
soon. I'll provide a new 2.5.0 test release of Cygwin with this patch
tomorrow or early next week.
Thanks again for the testcase,
Corinna
--=20
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
--cHMo6Wbp1wrKhbfi
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJW5JhBAAoJEPU2Bp2uRE+gPz4P/3/BPids/aCcUBPeEfgZTLnZ
vRa9igKC7OzMY5+GCtuSl4iQRoEtNr0Ncf2bNfjNBYa6zzS2NguJhqIj0SE3ZEYS
gBqw74PVbnAONeQgtO0rnaBidyw6sc0ZiYx/oizG4k1ma4vTTnQfpj0mgao4fXIj
WP7ZUdAmbTN8YMSXl2Zout31UaRCxVvZ48ZZYuAdPUTiUBU8yw7cFu/lVZD4jRkT
LXxgDvZsDMnpQ0XKyoEm+/64uQZxBkuQJ77tgxvycHNJAe1OFyudC1SmaPIk2gtC
RIf6fRRi/LKSUsCdFKAU0RGXHKvCSHy/mrCfhELDozoEb3bkUIv26rVY/Ndq+0cS
2xydeVlcLHnrTwx9kpP+C5qEkzUHvEHtKxlyL2h0dwJRJLs9FFij2+6v2rQXKxhU
zInyLcJxJvik8rYiOeIAlE6lySS7Dq67CQvV9KMu9wa6pJdTKeA68iuL4MPw123w
b6d0DJ4Yj/rFNffBO5HR06WjEAKN31M6ry1Spv9dZr9zNLxtW6rgDJg0HDP/MfTs
OGo3g9mb4G35ZmsnkVUFJG9/+KSXo6WEwLgWkV/9KI/ZR93xsL86rJ7rUvK+aWuf
jK5fuCyxyfJmDZsT/7rDIipTAslepCEmxqV5M0CFDGDeBVHrGMGgoax6lpYz08Y+
ouCH+jukOQVOOx3ig5Jx
=VyMh
-----END PGP SIGNATURE-----
--cHMo6Wbp1wrKhbfi--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |