|
Home About Us A-Z Index Search * Contact Us Register Login Press ShopThe Open Brand -- Problem Reporting and Interpretations System |
Problem Report 0777 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 0777.
Report 0777 Actions
Problem Report Number 0777 Submitter's Classification Test Suite problem State Resolved Resolution Test Suite Deficiency (TSD) Problem Resolution ID TSD.X.0292 Raised 1970-01-01 08:00 Updated 2003-03-13 08:00 Published 1998-09-18 08:00 Product Standard Commands and Utilities V2 (UNIX 95) Certification Program The Open Brand certification program Test Suite VSC version 4.1.6 Test Identification POSIX.annexA/lex 93 Problem Summary TSD4C.00219 This test may core dump on implementations because input() calls yywrap() and may recurse. Problem Text
This request is based on SR #2502.
This test is failing because it depends on a particular implementation's
input() function in a way that the standards are silent on.
Specifically, it is calling the input() function from the test's
yywrap() function. In the original lex implementation from AT&T this
worked because input() was just a macro that read up to the end-of-file
but no further. In another implementation, specifically flex version
2.5.4, the input() function calls yywrap() when it reaches end-of-file.
The leads to en infinite recursion with test #93 which eventually fails
when the stack can't be grown any more. The standards have the following
to say about yywrap() and input():
The functions or macros defined below are accessible to user code
included in the lex input. It is unspecified whether they appear in
the C code output of lex or are accessible only through the -l l
operand to c89 (the lex library).
...
int input(void)
Returns the next character from the input, or zero on end of
file. It shall obtain input from the stream pointer yyin,
although possibly via an intermediate buffer. Thus, once
scanning has begun, the effect of altering the value of yyin is
undefined. The character read is removed from the input stream
of the scanner without any processing by the scanner.
...
The following functions appear only in the lex library accessible
through the -l l operand; they can therefore be redefined by a
portable application:
...
int yywrap(void)
Called by yylex() at the end of file; the default yywrap()
always shall return 1. If the application requires yylex() to
continue processing with another source of input, then the
application can include a function yywrap(), which associates
another file with the external variable FILE *yyin and will
return a value of zero.
...
The specifications above seem to imply that input() will only read from
the current yyin stream and that yywrap() will only be called by
yylex(). However, neither of these two points are explicitly specified.
Thus, test #93 is explicitly depending on undefined behavior from the
standard.Test Output
520|0 1 809689 1 1|Assertion #93 (C): Test input() behavior
520|0 1 809689 1 11|Expected exit code = 0; Received 139
520|0 1 809689 1 12|Standard output isn't the same as file 'lex_eso_93_1'
520|0 1 809689 1 13|diff of "out.stdout" and "lex_eso_93_1":
520|0 1 809689 1 14|*** out.stdout Thu Apr 9 09:20:08 1998
520|0 1 809689 1 15|--- lex_eso_93_1 Thu Apr 9 09:20:06 1998
520|0 1 809689 1 16|***************
520|0 1 809689 1 17|*** 0 ****
520|0 1 809689 1 18|--- 1,6 ----
520|0 1 809689 1 19|+ rr
520|0 1 809689 1 20|+ rpassed first input() test
520|0 1 809689 1 21|+ ating
520|0 1 809689 1 22|+ rr
520|0 1 809689 1 23|+
520|0 1 809689 1 24|+ passed second input() test
220|0 1 1 09:24:08|FAILReview Information
Review Type TSMA Review Start Date null Completed null Status Complete Review Recommendation No Resolution Given Review Response
We agree this is a test suite deficiency in the test
suite version(s) listed.
Note that flex does not exhibit compliant behavior with this issue
resolved. The test subsequently fails because input() returns -1
instead of 0 due to differences in the processing of null characters.
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 0777
- List All PRs
- Search Reports
- Email the System Administrator
- View the The Open Brand Interpretations Database User Manual
Contact the Certification Authority