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

The Open Brand -- Problem Reporting and Interpretations System


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


Report 0357 Actions


    Problem Report Number 0357
    Submitter's Classification Specification problem
    State Resolved
    Resolution Temporary Interpretation (TIN)
    Problem Resolution ID TIN.X.0009
    Raised 1994-05-26 08:00
    Updated 2003-03-13 08:00
    Published 1994-06-20 08:00
    Product Standard Internationalised System Calls and Libraries (XPG4)
    Certification Program The Open Brand certification program
    Test Suite VSX4 version 4.3.2
    Test Identification XPG4.os/genuts/regcomp 3, 8, 9, 10, 11, 12, 13 and 14
    Specification System Interfaces and Headers Issue 4
    Location in Spec See Problem Text
    Problem Summary TIN4.009 An official interpretation reply requested to IEEE states that: PASC Interpretation reference 1003.2-92 #2 Class: No change This response will be incorporated in an IEEE interpretations publication, a...
    Problem Text
    An official interpretation reply requested to IEEE states that:

    _____________________________________________________________________________
    PASC Interpretation reference
    1003.2-92 #2

    Class: No change

    This response will be incorporated in an IEEE interpretations
    publication, and will be also made available on-line on the IEEE
    SPAsystem.

    _____________________________________________________________________________


    Interpretation Number: (to be assigned by the IEEE)
    Topic: Regular expressions
    Relevant Sections: B.5.2


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

    In Section B.5.2 - Description {of C Binding for Regular
    Expression Matching}, the standard states that the re_nsub
    member of the regex_t structure represents the number of
    parenthesized subexpressions found in pattern. [Draft 12 of
    IEEE Std 1003.2-1992 (July 1992), p. 766, lines 329-331]

    The standard then states that the pmatch argument

    shall point to an array with at least nmatch
    elements, and regexec() shall fill in the elements
    of that array with offsets of the substrings of
    string that correspond to the parenthesized
    subexpressions of pattern: pmatch[i].rm_so shall
    be the byte offset of the beginning and
    pmatch[i].rm_eo shall be one greater than the byte
    offset of the end of substring i. (Subexpression
    i begins at the ith matched open parenthesis,
    counting from 1.) Offsets in pmatch[0] shall
    identify the substring that corresponds to the
    entire regular expression.

    [Ibid., p. 766-767, lines 339-346]

    Thus, if pmatch[] contains nmatch elements, it can only hold
    nmatch-1 parenthesized subexpressions of string, since
    pmatch[0] represents the entire regular expression.

    The standard also states that ``if there are more than
    nmatch subexpressions in pattern (pattern itself counts as a
    subexpression), then regexec() [...] shall record only the
    first nmatch substrings.'' [Ibid., p. 767, lines 347-350]

    Lines 347-350 appear to contradict lines 339-346; the latter
    talks about parenthesized subexpressions, while the former
    mentions plain subexpressions. Is the intent of the
    standard to allow the re_nsub member to include the
    subexpression representing the entire regular expression in
    the count (since it is considered a subexpression on page
    767, lines 347-350), or does it only count explicitly
    parenthesized subexpressions? We believe this is the
    easiest way to rectify the ambiguity.

    IEEE Interpretation for 1003.2-1992
    -----------------------------------
    The subexpression representing the entire RE is to be included in the
    count represented in the re_nsub member. No change in wording is
    necessary.

    Rationale for Interpretation:
    -----------------------------
    The section quoted in the request, from Section B.5.2 (but lines 327-338
    in the Standard) contains the phrase "(pattern itself counts as an
    expression)", which the committee considers key to interpreting this
    apparent conflict.


    _____________________________________________________________________________
    (c) 1994 The Institute of Electrical and Electronic Engineers, Inc.
    Not to be published without prior written permission of the IEEE.


    >From the above statements, it is possible to conclude that the failing tests
    are not expecting the correct output.
    Test Output
    ************************************************************************
    /tset/XPG4.os/genuts/regcomp/T.regcomp 3 Failed

    Test Information:
    regcomp on basic regular expression "\(\(ABC\)z\(456\)D\)" did not
    return correct number of sub-expressions
    expected 3, actual 4
    regcomp on extended regular expression "(123)(ABC)" did not return
    correct number of sub-expressions
    Expected 2, actual 3
    ************************************************************************

    ************************************************************************
    /tset/XPG4.os/genuts/regcomp/T.regcomp 8 Failed

    Test Information:
    regcomp(preg, "\(b\)..\(yz1\).*\(89\)", 0) did not set re_nsub correctly
    Expected 3, actual 4
    regcomp(preg, "(bc)+(x)?", REG_EXTENDED) did not set re_nsub correctly
    Expected 2, actual 3
    regcomp(preg, "\(bc\).*\(D\)\(E\)\(F\)\(h\)\(i\)\(j\)\(8\)\(90k\)", 0)
    did not set re_nsub correctly
    Expected 9, actual 10
    regcomp(preg, "(bc).*(D)(E)(F)(h)(i)(j)(8)(90k)", REG_EXTENDED) did not
    set re_nsub correctly
    Expected 9, actual 10
    regcomp(preg, "xyz", 0) did not set re_nsub correctly
    Expected 0, actual 1
    ************************************************************************

    ************************************************************************
    /tset/XPG4.os/genuts/regcomp/T.regcomp 9 Failed

    Test Information:
    regcomp(preg, "\(b\)..\(yz1\).*\(89\)", 0) did not set re_nsub correctly
    Expected 3, actual 4
    regcomp(preg, "(bc)+(x)?", REG_EXTENDED) did not set re_nsub correctly
    Expected 2, actual 3
    ************************************************************************

    ************************************************************************
    /tset/XPG4.os/genuts/regcomp/T.regcomp 10 Failed

    Test Information:
    regcomp(preg, "\(abab\)\(cccc\)", 0) did not set re_nsub correctly
    Expected 2, actual 3
    regcomp(preg, "(abab)(cccc)", REG_EXTENDED) did not set re_nsub
    correctly
    Expected 2, actual 3
    ************************************************************************

    ************************************************************************
    /tset/XPG4.os/genuts/regcomp/T.regcomp 11 Failed

    Test Information:
    regcomp(preg, "\(ab\)\{1,\}\(ccc\)\{1,\}", 0) did not set re_nsub
    correctly
    Expected 2, actual 3
    regcomp(preg, "(ab){1,}(ccc){1,}", REG_EXTENDED) did not set re_nsub
    correctly
    Expected 2, actual 3
    ************************************************************************

    ************************************************************************
    /tset/XPG4.os/genuts/regcomp/T.regcomp 12 Failed

    Test Information:
    regcomp(preg, "\(ab\)\(xyz\)*\(def\)\{0,3\}\(ccc\)", 0) did not set
    re_nsub correctly
    Expected 4, actual 5
    regcomp(preg, "(ab)(xy)?(z)*(A){0,}(ccc)", REG_EXTENDED) did not set
    re_nsub correctly
    Expected 5, actual 6
    regcomp(preg, "(ab)|(yz)", REG_EXTENDED) did not set re_nsub correctly
    Expected 2, actual 3
    ************************************************************************

    ************************************************************************
    /tset/XPG4.os/genuts/regcomp/T.regcomp 13 Failed

    Test Information:
    regcomp(preg, "\(ab\)\(\(c\)yz\)*", 0) did not set re_nsub correctly
    Expected 3, actual 4
    regcomp(preg, "(ab)|((c)xyz)", REG_EXTENDED) did not set re_nsub
    correctly
    Expected 3, actual 4
    ************************************************************************

    ************************************************************************
    /tset/XPG4.os/genuts/regcomp/T.regcomp 14 Failed

    Test Information:
    regcomp(preg, "\(abcc\)\(x*\)", 0) did not set re_nsub correctly
    Expected 2, actual 3
    regcomp(preg, "(ab)(x*)", REG_EXTENDED) did not set re_nsub correctly
    Expected 2, actual 3
    ************************************************************************

    Review Information

    Review Type TSMA Review
    Start Date null
    Completed null
    Status Complete
    Review Recommendation No Resolution Given
    Review Response
    It is accepted that the above PASC interpretation is extant and that this
    has caused some confusion to implementors. It is understood that this
    interpretation is being challenged and that it is possible that the
    interpretation used in the tests may be considered correct. Given the
    considerable confusion surrounding this issue it is recommended that a
    temporary interpretation be granted while IEEE consider the position further.

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

    Problem Reporting System Options:

     

    Back   


Contact the Certification Authority