View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001209 | 1003.1(2016/18)/Issue7+TC2 | Shell and Utilities | public | 2018-09-08 13:01 | 2024-06-11 09:08 |
Reporter | joerg | Assigned To | ajosey | ||
Priority | normal | Severity | Editorial | Type | Clarification Requested |
Status | Closed | Resolution | Accepted | ||
Name | Jörg Schilling | ||||
Organization | |||||
User Reference | |||||
Section | printf | ||||
Page Number | 3116 | ||||
Line Number | 104230-104240 | ||||
Interp Status | --- | ||||
Final Accepted Text | |||||
Summary | 0001209: printf example for numeric value of character is wrong | ||||
Description | The description for the expected results in the example is missing the fact that the standard requires to print a diagnostic message and to create an exit code != 0. The reason is that the last two arguments are not fully converted as more than one character follows the single or double quote sign. | ||||
Desired Action | At line 104240 append to the paragraph: Since the last two arguments contain more characters than used for the conversion, a diagnostic message is generated and the exit code is != 0. | ||||
Tags | tc3-2008 |
|
The example is so clear, that printf %d '+3 is supposed to work, that it is hard to believe that this should generate an error. I think it just as likely that the "omitted' text is around lines 104155-6 (that is just before the "EXIT STATUS" section of the printf description in XCU 4) and that perhaps the correction should be to add a new clause at the end of that sentence ... or for a numeric conversion where the argument is in the form of a quoted string ('"' or "'" followed by text). This makes the "string" format args processing consistent in all forms, as much of the string as is needed is consumed, and any excess is ignored. |
|
I see no exception that would allow character constants to be processed without a check for completely using the argument, since the %d format does not match the string formats in the exception list. %d takes a numeric argument where a warning is required. Let me give a list of shells and standalone printf implementations that correctly give a warning: ksh93 bosh lksh (a mksh variant from the original author with builtin printf) /usr/bin/printf from Solaris /usr/bin/printf from Linux Note that ksh88 does not include a printf builtin and thus uses the standalone version. Apart from the example that is worth less than the normative text, I cannot see any justification for not printing a warning for incompletely converted character constants. |
Date Modified | Username | Field | Change |
---|---|---|---|
2018-09-08 13:01 | joerg | New Issue | |
2018-09-08 13:01 | joerg | Status | New => Under Review |
2018-09-08 13:01 | joerg | Assigned To | => ajosey |
2018-09-08 13:01 | joerg | Name | => Jörg Schilling |
2018-09-08 13:01 | joerg | Section | => printf |
2018-09-08 13:01 | joerg | Page Number | => 3116 |
2018-09-08 13:01 | joerg | Line Number | => 104230-104240 |
2018-09-11 01:37 | kre | Note Added: 0004114 | |
2018-09-11 10:44 | joerg | Note Added: 0004116 | |
2019-04-04 15:53 | nick | Interp Status | => --- |
2019-04-04 15:53 | nick | Desired Action Updated | |
2019-04-04 15:56 | geoffclare | Status | Under Review => Resolved |
2019-04-04 15:56 | geoffclare | Resolution | Open => Accepted |
2019-04-04 15:56 | geoffclare | Tag Attached: tc3-2008 | |
2019-11-12 15:30 | geoffclare | Status | Resolved => Applied |
2021-06-24 16:36 | geoffclare | Project | 1003.1(2008)/Issue 7 => 1003.1(2016/18)/Issue7+TC2 |
2024-06-11 09:08 | agadmin | Status | Applied => Closed |