HomeAbout Us A-Z IndexSearch * Contact Us Register LoginPress Shop

The Open Brand -- Problem Reporting and Interpretations System


Problem Report 0645 Details

Help Show help | Quick Search | Submit a Test Suite Support Request | Click here to view your privileges

This page provides all information on Problem Report 0645.


Report 0645 Actions


    Problem Report Number 0645
    Submitter's Classification Specification problem
    State Resolved
    Resolution Rejected (REJ)
    Problem Resolution ID REJ.X.0249
    Raised 1970-01-01 08:00
    Updated 2003-03-13 08:00
    Published null
    Product Standard Commands and Utilities V2 (UNIX 95)
    Certification Program The Open Brand certification program
    Test Suite VSC version 4.1.4
    Test Identification POSIX.cmd/printf/printf.sh 28
    Problem Summary PG4C.00027 printf "%b" "\\0000" must output a NULL character.
    Problem Text
    The testcase is testing printf %b "\\0000".

    The specification appears to be non-specific when discussing the
    %b conversion character.

    Page 583 of the XPG4 XCU V2 states the following:

    "argument
    The strings to be written to standard output, under the control
    of format; ..."

    Page 584 of the XPG4 XCU V2 states the following:

    "-- \0ddd, where ddd is a zero-, one-, two-, or three-digit octal number
    that will be converted to a byte with the numeric values specified by
    the octal number"

    Additionally, the XCU states:

    "Bytes from the converted string will be written until the end of the
    string or the number of bytes indicated by the precision specification
    is reached. If the precision is omitted, it will be taken to be infinite,
    so all bytes up to the end of the converted string will be written."

    The phrase "until the end of the string" is ambiguous; it could be
    read to say that the "bytes will be written until the end of the
    converted string" or "bytes will be written until the end of the
    string in the argument".

    VSC has taken the latter as the correct and only interpretation, but
    this seems to be a more specific interpretation then the spec wording
    would uphold.

    This might be seen more clearly by looking at an example:

    printf %b "ABCD\\0000FGHI"

    in the first case printf output would be "ABCD" and in the
    second case it would be "ABCDFGHI" (octal 000 is the nul char on
    our system).
    Test Output
    ************************************************************************
    /tset/POSIX.cmd/printf/printf.ex 1 Failed


    Test Information:
    Assertion #28 (A):
    got '' for value 0000
    ************************************************************************

    Review Information

    Review Type TSMA Review
    Start Date null
    Completed null
    Status Complete
    Review Recommendation No Resolution Given
    Review Response
    We recommend this request be refused.

    XCU issue 4, version 2, page 584 states:

    o An additional conversion character, b, will be supported as
    follows. The argument will be taken to be a string that may
    contain backslash-escape sequences. The following
    backslash-escape sequences will be supported:

    ...

    - \0ddd where ddd is a zero-, one-, two-, or three-digit octal
    number that will be converted to a byte with the numeric
    value specified by the octal number.


    The key here is the statement that

    The following backslash-escape sequences will be supported

    We believe that being supported means that legal escape sequences
    will be printed. Since \0000 is one of the legal escape
    sequences it must be possible to print it.

    The argument put forth above that the "end of the string"
    referenced could be the end of the converted string is invalid
    because in that case "\0000" will not lead to a NULL character
    being output.

    Using that argment, \0000 will evaluate to a NULL as the first
    character in the converted string. The NULL will terminate the
    string, leaving printf with an empty string. Nothing will be output.

    This is clearly not the intended output.

    Although not normative, the POSIX rationale and XCU printf
    Application Usage sections both support our belief by stating
    that printf "%b\n" "$*" is equivalent to echo "$*". This is not
    possible using the alternative logic presented for interpreting \0000.

    Review Type SA Review
    Start Date null
    Completed null
    Status Complete
    Review Resolution Rejected (REJ)
    Review Conclusion
    This request is refused.

    Problem Reporting System Options:

     

    Back   


Contact the Certification Authority