public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fweimer at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug stdio/31137] Regression vfprintf + setbuf (no buffering)
Date: Mon, 11 Dec 2023 13:48:16 +0000	[thread overview]
Message-ID: <bug-31137-131-T9i076icKY@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31137-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31137

--- Comment #2 from Florian Weimer <fweimer at redhat dot com> ---
The reproducer is misleading because GCC translates the fprintf call into an
fputs call. With -fno-builtin, I get this instead:

“
no setbuf
=========

Calling fprintf
idx=0 size=511

Calling vfprintf
idx=0 size=511


setbuf _IONBF
=============

Calling fprintf
idx=0 size=128
idx=1 size=128
idx=2 size=128
idx=3 size=127

Calling vfprintf
idx=0 size=128
idx=1 size=128
idx=2 size=128
idx=3 size=127
”

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 large
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 fopencookie
is inherently a byte stream interface, so there is no guarantee that one
fprintf call will be translated into one cookie write call.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-12-11 13:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11 12:58 [Bug stdio/31137] New: " david.marchand at redhat dot com
2023-12-11 13:00 ` [Bug stdio/31137] " fweimer at redhat dot com
2023-12-11 13:32 ` schwab@linux-m68k.org
2023-12-11 13:48 ` fweimer at redhat dot com [this message]
2023-12-11 15:04 ` schwab@linux-m68k.org
2023-12-11 17:37 ` fweimer at redhat dot com
2024-04-16 17:21 ` carlos at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31137-131-T9i076icKY@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).