public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "carlos at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug stdio/28943] printf field width specifier is inconsistent between %d and %f for multibyte output
Date: Mon, 06 Feb 2023 17:42:03 +0000	[thread overview]
Message-ID: <bug-28943-131-qI10rwVHjT@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28943-131@http.sourceware.org/bugzilla/>

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

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |carlos at redhat dot com

--- Comment #2 from Carlos O'Donell <carlos at redhat dot com> ---
I think it makes complete sense that where we talk about multi-byte characters
(logical columns) that we talk about character counts for width, just like for
wide interfaces we talk about wchar_t counts for width.

We cannot change POSIX at this point so I won't delve into the fact that width
for POSIX should also have been specified in terms of characters. The logical
column concept works if the output digits, grouping character, and <space> are
all 1 byte in width, but otherwise doesn't and requires translating to physical
columns for display (if you are going to display at all).

So the open question here is: Should we change I to make things consistent?

I think we should because it makes this a better interface to use based on
character counts, not bytes, and aligned with wprintf.

In summary:
- I agree that "I" should use character counts, not byte counts, and we should
make it consistent between %f and %d.
- We should consider the security impact of making this change and evaluate
current uses of the interface in known distributions.

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

  parent reply	other threads:[~2023-02-06 17:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04  8:12 [Bug stdio/28943] New: " fweimer at redhat dot com
2022-03-04  8:44 ` [Bug stdio/28943] " fweimer at redhat dot com
2022-05-23  9:08 ` cvs-commit at gcc dot gnu.org
2023-02-06 17:42 ` carlos at redhat dot com [this message]
2023-09-25 12:39 ` fweimer at redhat dot com
2023-09-25 13:50 ` vincent-srcware at vinc17 dot net
2024-03-25 14:34 ` schwab@linux-m68k.org

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-28943-131-qI10rwVHjT@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).