View Issue Details

IDProjectCategoryView StatusLast Update
00008941003.1(2013)/Issue7+TC1System Interfacespublic2019-06-10 08:54
Reporterdalias Assigned To 
PrioritynormalSeverityEditorialTypeClarification Requested
Status ClosedResolutionAccepted As Marked 
NameRich Felker
Organizationmusl libc
User Reference
Sectionfprintf
Page Number902
Line Number30242-30243
Interp Status---
Final Accepted Text0000894:0002570
Summary0000894: Missing text clarifying %#.0o format
DescriptionThe ISO C text (7.19.6.1 paragraph 6 in C99+TC3) for the '#' modifier character contains a parenthetical remark seen below clarifying that, in the case where the requirements of '#' (leading 0) and explicit zero precision (no characters) conflict, the '#' wins:

"The result is converted to an ''alternative form''. For o conversion, it increases the precision, if and only if necessary, to force the first digit of the result to be a zero (if the value and precision are both 0, a single 0 is printed)."

The corresponding POSIX text is missing this remark, and reads:

"Specifies that the value is to be converted to an alternative form. For o conversion, it increases the precision (if necessary) to force the first digit of the result to be zero."

Thus, to someone reading only the POSIX text, it's ambiguous what the output should be given something like:

printf("%#.0o", 0);
Desired ActionAdd the parenthetical remark from the ISO C text.
Tagstc2-2008

Activities

geoffclare

2015-02-26 17:22

manager   bugnote:0002570

Last edited: 2015-03-26 10:57

On Page: 902 Line: 30242-30243

Change:
For <tt>o</tt> conversion, it increases the precision (if necessary) to force the first digit of the result to be zero.

to:
For <tt>o</tt> conversion, it shall increase the precision, if and only if necessary, to force the first digit of the result to be a zero (if the value and precision are both 0, a single 0 is printed).


Make the same change on Page: 983 Line: 33180 Section: fwprintf().

geoffclare

2015-03-26 12:08

manager   bugnote:0002604

I noticed that the same change is needed for fwprintf(), so I have edited 0000894:0002570 to add this change. It seems like a no-brainer, so I did not feel the need to reopen the bug.

Issue History

Date Modified Username Field Change
2014-11-15 06:05 dalias New Issue
2014-11-15 06:05 dalias Name => Rich Felker
2014-11-15 06:05 dalias Organization => musl libc
2014-11-15 06:05 dalias Section => fprintf
2014-11-15 06:05 dalias Page Number => unknown
2014-11-15 06:05 dalias Line Number => unknown
2015-02-26 17:22 geoffclare Note Added: 0002570
2015-02-26 17:23 geoffclare Page Number unknown => 902
2015-02-26 17:23 geoffclare Line Number unknown => 30242-30243
2015-02-26 17:23 geoffclare Interp Status => ---
2015-02-26 17:23 geoffclare Final Accepted Text => 0000894:0002570
2015-02-26 17:23 geoffclare Status New => Resolved
2015-02-26 17:23 geoffclare Resolution Open => Accepted As Marked
2015-02-26 17:23 geoffclare Tag Attached: tc2-2008
2015-03-26 10:57 geoffclare Note Edited: 0002570
2015-03-26 12:08 geoffclare Note Added: 0002604
2019-06-10 08:54 agadmin Status Resolved => Closed