From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9C14A3858C50; Mon, 11 Dec 2023 13:48:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9C14A3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1702302496; bh=K8FHW4UpRWHHjGXtFQ7JbqFyXOyiPwT7j3LHDNTQuvk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ykPe/puyY3wZlgffaD6WKmVUdlWtYNNYZkjUHJpyMsedHjnpLkFDpmjKOkeii5mF7 X7uiCYfV3Ifp269kiW7FSc6Xj+mW72fNIuLKgAtco32KwkqzJAOYBACju1iYIRwVVA iloLPiWFaYc/rr7Q3BvM4rPRHIGv0yzZhJ6Gniiw= From: "fweimer at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug stdio/31137] Regression vfprintf + setbuf (no buffering) Date: Mon, 11 Dec 2023 13:48:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: stdio X-Bugzilla-Version: 2.37 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fweimer at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31137 --- Comment #2 from Florian Weimer --- The reproducer is misleading because GCC translates the fprintf call into an fputs call. With -fno-builtin, I get this instead: =E2=80=9C no setbuf =3D=3D=3D=3D=3D=3D=3D=3D=3D Calling fprintf idx=3D0 size=3D511 Calling vfprintf idx=3D0 size=3D511 setbuf _IONBF =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Calling fprintf idx=3D0 size=3D128 idx=3D1 size=3D128 idx=3D2 size=3D128 idx=3D3 size=3D127 Calling vfprintf idx=3D0 size=3D128 idx=3D1 size=3D128 idx=3D2 size=3D128 idx=3D3 size=3D127 =E2=80=9D So at least it's consistent. Echoing what Andreas said, I think you are just observing the effect of a reduced buffer size. It was always there, except that we used to have a lar= ge on-stack buffer in vfprintf (8192 bytes, I believe), which probably papered over it. The 128 bytes fallback buffer size is arbitrary. We can probably increase it somewhat if it reduces the compatibility impact of this change. But fopenco= okie is inherently a byte stream interface, so there is no guarantee that one fprintf call will be translated into one cookie write call. --=20 You are receiving this mail because: You are on the CC list for the bug.=