Austin Group Defect Tracker

Aardvark Mark III


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
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 2018-09-11 10:44
Reporter joerg View Status public  
Assigned To ajosey
Priority normal Resolution Open  
Status Under Review  
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 that used for the
conversion, a diagnostic message is generated and the exit code is != 0.
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0004114)
kre (reporter)
2018-09-11 01:37

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.
(0004116)
joerg (reporter)
2018-09-11 10:44

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.

- Issue History
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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker