|Anonymous | Login||2021-05-16 02:31 UTC|
|Main | My View | View Issues | Change Log | Docs|
|Viewing Issue Simple Details|
|ID||Category||Severity||Type||Date Submitted||Last Update|
|0001209||[1003.1(2008)/Issue 7] Shell and Utilities||Editorial||Clarification Requested||2018-09-08 13:01||2019-11-12 15:30|
|Final Accepted Text|
|Summary||0001209: printf example for numeric value of character is wrong|
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.
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.
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:
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
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.
|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|
|Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group|