|
Home About Us A-Z Index Search * Contact Us Register Login Press ShopThe Open Brand -- Problem Reporting and Interpretations System |
Problem Report 0212 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 0212.
Report 0212 Actions
Problem Report Number 0212 Submitter's Classification Test Suite problem State Resolved Resolution Test Suite Deficiency (TSD) Problem Resolution ID TSD.X.0212 Raised 1995-05-18 08:00 Updated 2003-03-13 08:00 Published 1995-05-25 08:00 Product Standard Internationalised System Calls and Libraries (XPG4) Certification Program The Open Brand certification program Test Suite VSX4 version 4.3.4 Test Identification XPG4.os/genuts/wordexp 2, 3, 5, 8 Problem Summary TSD4.212 These tests are failing because getenv() is used in a non-portable manner (similar to TSD4san.182). The XPG4 standard states the following: "The {getenv()} function searches the environment list for a... Problem Text
These tests are failing because getenv() is used in a non-portable
manner (similar to TSD4san.182). The XPG4 standard states the
following:
"The {getenv()} function searches the environment list for a
string of the form "{name=value}", and returns a pointer to a
string containing the "value" for the specified name. ... The
string pointed to must not be modified by the application, but
may be overwritten by a subsequent call to {getenv()} or
{putenv()} but will not be overwritten by a call to any other
function in this document."
genuts/wordexp/wordexp.c has a function called prepare_tests() which
violates this section of the standard by apparently assuming that
getenv() will return different pointers for different variable names
requested. prepare_tests() does a getenv("HOME") and assigns the
return pointer to a variable called env_home. This buffer can next be
modified by calls to getenv("IFS") later in prepare_tests(). At this
point, the buffer pointed to by env_home are not predictable because
the system might have overwritten it. It might point to the value of
either the HOME or IFS environment variables.
It is interesting to note that in this example, env_home appears to
change value. The last two errors in test #2 both lead one to believe
that upon entry to test2(), the most recent getenv() was for the
environment variable "TZ". This is the point at which env_home is used
in a call to sprintf() to construct the expected strings of the last two
tests. The other two tests of test #2 are using what appears to be the
result of performing getenv("PATH"). There are no instances in
wordexp.c performing getenv()'s for TZ or PATH but if they are performed
in other code (for instance, the TET harness), this would explain why
env_home was changed in the way it was. At the time env_home took on
the value of the TZ or PATH variables, the buffer had already been
changed by getenv("IFS") and this alone would be enough to contaminate
the results.
Since all tests that use env_home depend on prepare_tests() to use
getenv("HOME") the same way, they are all suspectible to unpredictable
results. We suggest that env_home be a separate buffer (rather than
simply an a copy of an address that getenv() returns) that is copied to
from the buffer getenv("HOME") returns.Test Output
/tset/XPG4.os/genuts/wordexp/T.wordexp 2 Failed
Test Description:
If wordexp() is supported:
When words contains an unquoted word of the form $var or ${var},
then a call to wordexp() replaces the text $var or ${var} with the
contents of the environment variable var, or with an empty string
if var is not defined in the environment.
Otherwise:
A call to wordexp() returns WRDE_NOSYS and sets errno to ENOSYS.
Test Strategy:
CALL wordexp.
VERIFY wordexp() returned 0.
VERIFY wordexp() found correct number of words.
VERIFY matched vector is correct.
CALL wordexp.
VERIFY wordexp() returned 0.
VERIFY wordexp() found correct number of words.
VERIFY matched vector is correct.
CALL wordexp.
VERIFY wordexp() returned 0.
VERIFY wordexp() found correct number of words.
VERIFY matched vector is correct.
CALL wordexp.
VERIFY wordexp() returned 0.
VERIFY wordexp() found correct number of words.
VERIFY matched vector is correct.
CALL wordexp.
VERIFY wordexp() returned 0.
VERIFY wordexp() found correct number of words.
VERIFY matched vector is correct.
Test Information:
wordexp("$HOME", ...) returned vector with expected word missing
expected words:
/bin:/tmp/usr/TET/vsx4/BIN:/tmp/usr/TET/vsx4/../bin
actual words:
/tmp/usr/TET/vsx4
wordexp("${HOME}", ...) returned vector with expected word missing
expected words:
/bin:/tmp/usr/TET/vsx4/BIN:/tmp/usr/TET/vsx4/../bin
actual words:
/tmp/usr/TET/vsx4
wordexp("==${HOME}==", ...) returned vector with expected word missing
expected words:
==EST5EDT==
actual words:
==/tmp/usr/TET/vsx4==
wordexp("==${HOME}R==", ...) returned vector with expected word missing
expected words:
==EST5EDTR==
actual words:
==/tmp/usr/TET/vsx4R==Review Information
Review Type TSMA Review Start Date null Completed null Status Complete Review Recommendation No Resolution Given Review Response
This is accepted as a test suite fault and it is recommended that this be
treated as a Test Suite Deficiency.
Review Type SA Review Start Date null Completed null Status Complete Review Resolution Test Suite Deficiency (TSD) Review Conclusion
This is an agreed Test Suite Deficiency.
Problem Reporting System Options:
- View Report 0212
- List All PRs
- Search Reports
- Email the System Administrator
- View the The Open Brand Interpretations Database User Manual
Contact the Certification Authority