Skip to contentSkip to conversation

New: printf family returns number of bytes written, not characters

Bug 218600 [email protected] 1 participant 2 messages Mar 14, 2024 – Mar 15, 2024 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=218600

Bug ID: 218600
Summary: printf family returns number of bytes written, not
characters
Product: Documentation
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: low
Priority: P3
Component: man-pages
Assignee: [email protected]
Reporter: [email protected]
Regression: No

For comparison:
https://pubs.opengroup.org/onlinepubs/9699919799/

In an utf8 environment the number of bytes written may differ from the number of characters.

Example:
fprintf( stdout, "%*s\n", fprintf( stdout, "öäüÖÄÜßµł€\n"), "^");

From https://man7.org/linux/man-pages/man3/dprintf.3.html:
"Upon successful return, these functions return the number of
characters printed (excluding the null byte used to end output to strings)."

Greetings.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#1 lore raw

[Bug 218600] printf family returns number of bytes written, not characters

https://bugzilla.kernel.org/show_bug.cgi?id=218600

Alejandro Colomar ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |CODE_FIX

--- Comment #1 from Alejandro Colomar ([email protected]) --- Thanks! This has been fixed now:

<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=e0fc7ee5e3d664c83bd0f4fc751ef80cf38ae1bc>

Have a lovely day!
Alex

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.