|
Home About Us A-Z Index Search * Contact Us Register Login Press ShopThe Open Brand -- Problem Reporting and Interpretations System |
Problem Report 0609 Details
Show help | Quick Search | Submit a Test Suite Support Request | Click here to view your privileges
This page provides all information on Problem Report 0609.
Report 0609 Actions
Problem Report Number 0609 Submitter's Classification Test Suite problem State Resolved Resolution Rejected (REJ) Problem Resolution ID REJ.X.0213 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.upe/ex 447 448 Problem Summary PG4C.00063 Unexpected shell expansion. Problem Text
POSIX.upe/ex/ex_07.sh - FAILED. Assertion number: tp447 and tp448
What the test performs :
=======================
# Assertion: 447
# When a regular expression contains the character sequence \e<, then this
# sequence is matched against the beginning of a word in the lines being
# matched. (The term word is as defined in POSIX.2 section 5.10.7.2).
# Strategy:
#
# Use the construct \< in a substitute command to replace the beginning
# of words with a known character (in this case `x'). Verify that the
# substitution succeeds when words begin with an alphabetic, numeric,
# or _ character and separated by spaces.
#
# Repeat the test with the words separated by non alphanumeric characters
# from the POSIX locale.
----------------------------------------------------------------------
# Assertion: 448
# When a regular expression contains the character sequence \e>, then
# this sequence is matched against the end of a word in the lines being
# matched. (The term word is as defined in POSIX.2 section 5.10.7.2).
# Use the construct \> in a substitute command to replace the end
# of words with a known character (in this case `x'). Verify that the
# substitution succeeds when words end with an alphabetic, numeric,
# or _ character and separated by spaces.
#
# Repeat the test with the words separated by non alphanumeric characters
# from the POSIX locale.
----------------------------------------------------------------------
The Assertions #447 and #448 both essentially do similar tests
except that #447 tests for \e< wherease #448 tests for \e>.
We will explain in detail the problem with #447 and the same
shall apply to #448.
We observe that the test fails for \ and * non-alphanumeric cases.
What the POSIX Standard states:
-------------------------------
Standard : POSIX
Section : 3.2.2
Page : 118
line : 44-47
"3.2.2 Single Quotes
Enclosing characters in single quotes (' ') shall preserve
the literal value of each character within the single
quotes."
What the test does is as follows:
--------------------------------
The test first assigns non-alphanumeric characters to the
variable "chars". Among the many non-alphanumric characters,
the \ and * are the two characters which cause the test to
fail.
The following is the assignment to the variable "chars" :
chars='! @ # $ % ^ & \* ( ) + ~ - = ` { } [ ] | \\ : " ; , . / < >'
Since the assignment is in single quotes, the variable
"chars" will retain the literal character sequence that has
been assigned to it. Consider the following cases:
1. '\*': The test statement,
printf "%s\n" "word${c}word" > ex_data_$i
will generate "word\*word" and not the expected string,
^^^^^^^^^^
"word*word".
^^^^^^^^^
This makes the test fail.
We understand that the intention of escaping "*" is to
avoid expansion of "*" to filenames by the shell in the
"for c in $chars" statement. One possible way of doing
this will be to use "set -f" in the beginning of the test
case and initialising "chars" without escaping *.
2. '\\':
The test statement,
printf "%s\n" "word${c}word" > ex_data_$i
will generate "word\\word" and not the expected string,
^^^^^^^^^^
"word\word".
^^^^^^^^^
This makes the test fail.
We understand that the intention of escaping the \ is to
preserve the literal meaning of \ but it is being already
done by putting \ under single quotes. Hence only \
should be used instead of \\.
Based on the above arguments we feel that the tests #447 and
#448 are in error and should be waivered.
Test Output
20|1 1 12812 1 1|Assertion #447 (C): construct \< matches the beginning of a wo
rd
520|1 1 12812 1 1|Expected exit code = 0; Received 127
520|1 1 12812 1 2|char "*" not matched as word delimiter
520|1 1 12812 1 3|Expected exit code = 0; Received 127
520|1 1 12812 1 4|char "" not matched as word delimiter
520|1 1 12812 1 5|2 subtests did not generate expected result
220|1 1 1 15:12:41|FAIL
410|1 447 1 15:12:41|IC End
400|1 448 1 15:12:41|IC Start
200|1 1 15:12:41|TP Start
520|1 1 12812 1 1|Assertion #448 (C): construct \> matches the end of a word
520|1 1 12812 1 1|char "*" not matched as word delimiter
520|1 1 12812 1 2|char "" not matched as word delimiter
520|1 1 12812 1 3|2 subtests did not generate expected result
220|1 1 1 15:29:40|FAIL
410|1 448 1 15:29:40|IC End
80|1 0 15:29:41|TC EndReview 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.
We believe the test is correct.
Although extra characters are present in some cases during the test,
they do not result in differences in the results.
In the for statement, the escaped * character prevents any
pathname expansion from occurring. Final quote removal does not
occur, because the escape characters do not appear in the original
word, $chars. Therefore, the extra backslashes appear in for both
the * and \ characters.
The strings resulting from parameter expansion in the for loop,
"word\*word" and "word\\word", are used in the printf statements for
the starting input files and an "x" is placed in the appropriate place
in the expected output files.
Because the characters are quoted, no pathname expansion is attempted.
No quote removal occurs because the escape characters do not appear in
the original word, "word${c}word". Thus, the files contain something
like "word\*word" or "word\\word".
The extra characters in the output do not change the results of the test,
since the definition of word in the Command Descriptions in ex section
results in the selection of "word" in either case since all other characters
are treated as delimiters between the words.
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:
- View Report 0609
- List All PRs
- Search Reports
- Email the System Administrator
- View the The Open Brand Interpretations Database User Manual
Contact the Certification Authority