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

The Open Brand -- Problem Reporting and Interpretations System


Problem Report 0682 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 0682.


Report 0682 Actions


    Problem Report Number 0682
    Submitter's Classification Specification problem
    State Resolved
    Resolution Permanent Interpretation (PIN)
    Problem Resolution ID PIN.X.0075
    Raised 1970-01-01 08:00
    Updated 2003-03-13 08:00
    Published 1997-07-07 08:00
    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/expr 10
    Specification Commands and Utilities Issue 4 Version 2
    Location in Spec See Problem Text
    Problem Summary PIN4C.00039 This test may fail on implementations that adhere to POSIX.2b behavior and return zero instead of nothing.
    Problem Text
    This test may fail on implementations that adhere to POSIX.2b
    behavior and return zero instead of nothing.

    The test in question verifies that the output of expr in either of the
    following command lines is empty:

    expr 0 \| ""
    expr "" \| ""

    However, this is not the historical behavior of the expr utility.
    Rather, historical behavior for both of these invocations of expr
    is to write the value 0 followed by a newline, and IEEE interpretation
    pasc-1003.2-104 indicates that this change was inadvertent. Moreover,
    in the most recent draft of POSIX.2b the language in the standard
    is changed to support the historical behavior. In view of the interpretation
    and the pending change in the POSIX.2 specification, we think that
    it is appropriate to deem this a grey area in the specification and
    allow either behavior.

    Here is the text of IEEE Interpretation pasc-1003.2-104:
    -----------------start of interpretation-------------------
    _____________________________________________________________________________
    (c) 1995 The Institute of Electrical and Electronic Engineers, Inc.
    Not to be published without prior written permission of the IEEE.



    _____________________________________________________________________________
    PASC Interpretation reference
    1003.2-92 #104

    _____________________________________________________________________________

    Interpretation Number: XXXX
    Topic: expr | operator
    Relevant Sections: 4.22.7

    Interpretation Request:
    -----------------------

    Date: Tue, 4 Apr 1995 17:39:13 -0700
    From: Chuck.Hickey@Eng.Sun.COM (Chuck Hickey [CONTRACTOR])

    Dear Standards Board,
    I would like to request a formal interpretation on the following
    issue concerning the expr utility in POSIX.2.


    Standard: IEEE Std 1003.2-1992
    Topic: expr | operator
    Relevant Sections: 4.22.7

    In IEEE Std 1003.2-1992 section 4.22.7 (Extended Description of
    the expr utility), P277, L4159-4160, the description of the |
    and & operators is:
    expr1 | expr2 Returns the evaluation of expr1 if it
    is neither null nor zero; otherwise,
    it returns the evaluation of expr2.
    expr1 & expr2 Returns the evaluation of expr1 if
    neither expression evaluates to null
    or zero; otherwise, returns zero.

    This requires that the command:
    expr "" \| ""
    produce an empty line as its output.

    In both BSD and System V historic practice, the | operator
    acted as a boolean arithmetic operator like the & operator. If
    the expressions evaluated to null strings, the result was "0\n",
    not a null.

    The rationale in section E.4.22, P904, L6209-6213 acknowledges
    that expr could be replaced by other shell constructs in the
    POSIX.2 shell, but says the utility was kept because of the
    many historical shell scripts that use it. The rationale also
    mentions that other changes in early drafts of the standard
    were backed out because they weren't historic practice
    (see L6229-6230). It seems strange that this change to
    historical practice was not documented if it was intentional.

    To match historic BSD and System V implementations, the
    description of the | operator on P277, L4159-4169 should have
    been something like:
    expr1 | expr2 Returns the evaluation of expr1 if it is neither
    null nor zero; otherwise, the evaluation of
    expr2 if it is not null; otherwise, returns
    zero.

    Was this change to historic practice intentional?



    Interpretation response
    ------------------------
    The standard states the behavior for the | operator for the expr cmd, and
    conforming implementations must conform to this. However, concerns
    have been raised about this which are being referred to the sponsor.


    Rationale:
    None

    Forwarded to Interpretations group: Apr 5 1995
    Proposed resolution circulated: May 16th
    Comments due: June 15th
    Finalised: June 16th 1995
    ------------------end of interpretation--------------------
    Test Output
    -----------------start of test output------------------

    ************************************************************************
    /tset/POSIX.cmd/expr/expr.ex 1 Failed


    Test Information:
    Assertion #10 (A):
    Note: An IEEE POSIX.2 interpretation request is pending on
    non-historical behavior when expr2 is null.
    Actual output differs from expected.
    diff of "expr_actual" and "expr_eso":
    *** expr_actual Tue Sep 5 16:10:57 1995
    --- expr_eso Tue Sep 5 16:10:57 1995
    ***************
    *** 1 ****
    - 0
    --- 0 ----
    Actual output differs from expected.
    diff of "expr_actual" and "expr_eso":
    *** expr_actual Tue Sep 5 16:10:59 1995
    --- expr_eso Tue Sep 5 16:10:59 1995
    ***************
    *** 1 ****
    - 0
    --- 0 ----
    ************************************************************************

    ------------------end of test output-------------------

    Review Information

    Review Type TSMA Review
    Start Date null
    Completed null
    Status Complete
    Review Recommendation No Resolution Given
    Review Response
    Anticipating acceptance of the modified expr specification in
    POSIX 1003.2b/D11 and the eventual alignment of the tests with it
    a temporary interpretation is recommended.

    Review Type SA Review
    Start Date null
    Completed null
    Status Complete
    Review Resolution Permanent Interpretation (PIN)
    Review Conclusion
    A Permanent Interpretation is granted.

    Problem Reporting System Options:

     

    Back   


Contact the Certification Authority