From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E78D73858C50; Mon, 6 Feb 2023 17:42:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E78D73858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675705323; bh=Jgs1jBvwsS4SSjzC5+oYSyN8pKKX9yZTXf5a3idMroI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ND3ld/a0yGqUzuG0GOtvEcV2ZC5BVpVjcI1N+JgljfSBRfsqL/C6gb7Y7F7P9ge3g 9xJnflcIqD+zQMYvJQ2ZB96ExGA/rZsNaJUn2H55YB0GsfGc7EwAHhCn8rIgr3h/y1 4Cx5oNW8++JppcAbCozRJ5UassdJZ196cwmMmLp0= From: "carlos at redhat dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: stdio X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: carlos 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: security- X-Bugzilla-Changed-Fields: cc 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=3D28943 Carlos O'Donell changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |carlos at redhat dot com --- Comment #2 from Carlos O'Donell --- I think it makes complete sense that where we talk about multi-byte charact= ers (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 wi= dth for POSIX should also have been specified in terms of characters. The logic= al column concept works if the output digits, grouping character, and = are all 1 byte in width, but otherwise doesn't and requires translating to phys= ical 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 sho= uld 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. --=20 You are receiving this mail because: You are on the CC list for the bug.=