From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13840 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "A. Wilcox" Newsgroups: gmane.linux.lib.musl.general Subject: Re: fgets() doesn't call fsync() before getting input Date: Thu, 21 Feb 2019 10:31:36 -0600 Organization: =?UTF-8?Q?Ad=c3=a9lie_Linux?= Message-ID: <5c1de98e-9606-81d6-0e69-8f3dbb916065@adelielinux.org> References: <20190221152243.GF23599@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kS6OocLDmr7oPuLoFagRljZQOm1EQt0Xj" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="60654"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux ppc64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 To: musl@lists.openwall.com Original-X-From: musl-return-13856-gllmg-musl=m.gmane.org@lists.openwall.com Thu Feb 21 17:31:44 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1gwrGB-000Ff2-PY for gllmg-musl@m.gmane.org; Thu, 21 Feb 2019 17:31:43 +0100 Original-Received: (qmail 2037 invoked by uid 550); 21 Feb 2019 16:31:41 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 2017 invoked from network); 21 Feb 2019 16:31:41 -0000 Openpgp: preference=signencrypt In-Reply-To: <20190221152243.GF23599@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:13840 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --kS6OocLDmr7oPuLoFagRljZQOm1EQt0Xj Content-Type: multipart/mixed; boundary="WFjZr1Omu0MhzbBVlkEQkXvKHRGBdTYTE"; protected-headers="v1" From: "A. Wilcox" To: musl@lists.openwall.com Message-ID: <5c1de98e-9606-81d6-0e69-8f3dbb916065@adelielinux.org> Subject: Re: [musl] fgets() doesn't call fsync() before getting input References: <20190221152243.GF23599@brightrain.aerifal.cx> In-Reply-To: <20190221152243.GF23599@brightrain.aerifal.cx> --WFjZr1Omu0MhzbBVlkEQkXvKHRGBdTYTE Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 02/21/19 09:22, Rich Felker wrote: > On Thu, Feb 21, 2019 at 10:09:03AM -0500, James Larrowe wrote: >> I'm writing a program that prints a dialogue to the screen and then as= ks >> for input. In musl, the dialogue does not show before fgets() is calle= d, >> however in glibc it does. That causes a blank prompt and also some >> confusion. Attached is a minimal example and a log. >=20 > This difference is intentional. The specification allows but does not > require that attempting to read from a line-buffered input stream > causes all line-buffered output streams to be flushed. This behavior > was somewhat convenient for old-style input-prompt idioms, but it > doesn't scale with large numbers of files open and deadlocks with some > multi-threaded usage. The portable solution here for applications is > to fflush (not fsync) the particular stream you want flushed. >=20 > Rich FWIW, the only package we've come across where this is a problem is mac-fdisk (which hasn't been updated since 1997 - yes, 22 years ago). We have a patch: https://code.foxkit.us/adelie/packages/blob/master/user/mac-fdisk/flush-s= tdout.patch Best, --arw --=20 A. Wilcox (awilfox) Project Lead, Ad=C3=A9lie Linux https://www.adelielinux.org --WFjZr1Omu0MhzbBVlkEQkXvKHRGBdTYTE-- --kS6OocLDmr7oPuLoFagRljZQOm1EQt0Xj Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjNyWOYPU1SaTSMHHyynLUZIrnRQFAlxu0mgACgkQyynLUZIr nRRzvw//eSfVgs5pEMWeWctVsRfSGq6UgwRIzjlBp3WCem1Vld0slsnV+1lG308D wswtBF/+KGyBR+1//yDUN6G9283Hnx7d/rjP/p/aRUmjGSCTT5N3hwDB6UfWAYGD F4vY6nkYhlk1s6ARnipHUP2zPsZirPKAMASnKoRLMBB92yt1TSszLaf60WCXRjq9 loLj010GgLk21f4i/PO3pTx4VTsDKesA7/OopeOmnHt2Kj6Ek9IyY2YdnOkQr6kC jy6Bh+zKWLAk6COgfIAy5uniMNfN1tsRQ0jT1fYa2yOUTKuRhbfnFeRh+EdU12LX ZBoRaTJDU+n47YgFmhDLHR1OwF4A+cWz8/FNttJGa6N0KNhj+QISumcjnA7IzZBJ XsXglzwAg7oocgmucIKE9/sBoa+cm5Qq02nySEb5+c/2WQfJSUH8q75TydUvYn2b UZ+siBVBcNlgsWUxjAE2dxh2lxJrs1lCTuxY+vfLl5Dym+qqSNyZSEiw9zuP1fZx 4sfKxwG9FVqdkfi83Dpxi67ZK2gKFrbrlm8dOAejXOxN2L5i3ZQuFl2YB039pbr8 744z4bBxVFQFTIawRREsMCaDh6ta4mkk3/i0XIXtg19QEVJkfrD84jvlCqF8WdPb P0kAek8IvCxA0KTQPD62nb2IXNGOCNkCgMJPDuNzlb9OKs/jbjw= =47jY -----END PGP SIGNATURE----- --kS6OocLDmr7oPuLoFagRljZQOm1EQt0Xj--