|
Home About Us A-Z Index Search * Contact Us Register Login Press ShopThe Open Brand -- Problem Reporting and Interpretations System |
Problem Report 0150 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 0150.
Report 0150 Actions
Problem Report Number 0150 Submitter's Classification Test Suite problem State Resolved Resolution Test Suite Deficiency (TSD) Problem Resolution ID TSD.X.0150 Raised 1994-11-05 08:00 Updated 2003-03-13 08:00 Published 1994-06-08 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 POSIX.os/files/fstat 1 Problem Summary TSD4.150 The test that is failing does basically this: fd = creat("file"); time(&t0); sleep(2); write(fd, buf, ...); close(fd); time(&t1); fd2=open("file", ...); fstat(fd2, &stbuf); if (stbuf.st_atime != t0 &&... Problem Text
The test that is failing does basically this:
fd = creat("file");
time(&t0);
sleep(2);
write(fd, buf, ...);
close(fd);
time(&t1);
fd2=open("file", ...);
fstat(fd2, &stbuf);
if (stbuf.st_atime != t0 && stbuf.st_atime != t0+1 &&
stbuf.st_atime != t0+2)
{
if (testfail++ == 0)
xx_rpt(FAILURE);
in_rpt("fstat() set st_atime incorrectly: expected %ld, observed %ld",
(long)t0, (long)stbuf.st_atime);
}
The only place the atime for "file" should change here is when the
file is creat'd. So the atime on the file will be t0, or slightly
less than t0 since the creat() is done before the time(). But the
test expects that the atime will be the same or slightly more than t0.
This is wrong, and this is why this test fails occasionally.Test Output
************************************************************************
/tset/POSIX.os/files/fstat/T.fstat 1 Failed
Test Description:
A call to fstat() stores information about the file associated with
the named file descriptor in the area pointed to by buf and returns a
value of zero.
Posix Ref: Component FSTAT Assertion 5.6.2.2-04(A)
Posix Ref: Component FSTAT Assertion 5.6.2.2-05(A)
Posix Ref: Component FSTAT Assertion 5.6.2.2-06(A)
Posix Ref: Component FSTAT Assertion 5.6.2.2-07(A)
Posix Ref: Component FSTAT Assertion 5.6.2.2-08(A)
Posix Ref: Component FSTAT Assertion 5.6.2.2-09(A)
Posix Ref: Component FSTAT Assertion 5.6.2.2-10(A)
Posix Ref: Component FSTAT Assertion 5.6.2.2-11(A)
Posix Ref: Component FSTAT Assertion 5.6.2.2-12(A)
Posix Ref: Component FSTAT Assertion 5.6.2.2-13(A)
Test Strategy:
CHECK st_dev, st_ino, S_ISREG(st_mode), st_size, st_atime, st_mtime
and st_ctime for a regular file as follows:
CREATE file using crfile() - (genlib)
OBTAIN time using time()
SLEEP for 2 seconds using sleep()
WRITE data to file using write()
CLOSE file descriptor using close()
OBTAIN time using time()
SLEEP for 1 second using sleep()
OBTAIN file status information for "." and ".." using stat()
OPEN file using open() with a time out
OBTAIN file status information for test file using fstat()
VERIFY that fstat() returned 0
VERIFY that st_dev is the same as for "." and ".."
VERIFY that st_ino is different from "." and ".."
VERIFY that file is a regular file using S_ISREG()
VERIFY that st_size is the same as the number of bytes written to
the file
VERIFY that st_atime is set to the value when time() was first
called
VERIFY that st_mtime and st_ctime are set to the value when time()
was subsequently called
UNLINK file
CHECK st_mode permission bits as follows:
CREATE file using crfile() - (genlib)
FOR each portable file nane with each of the file modes and it's
complement:
CHANGE the mode of the current portable filename using chmod()
with the current file mode
OBTAIN file status information using fstat()
VERIFY that fstat() returned 0 and errno was not set
VERIFY that st_mode is the same as the current mode
UNLINK file
CHECK st_uid and st_gid as follows:
CREATE child process using cppair()
CREATE subprogram using execve passing as parameters: the program
name, the file name, the group and user ids for vsxg1 and vsx1
CREAT file using creat() with read, write and execute
permissions for user, group and others owned by user vsx1 and
group vsxg1
OBTAIN file status information using fstat()
VERIFY that fstat() returned 0 and errno was not set
VERIFY that st_uid and st_gid are set to vsx1 and vsxg1
CHECK st_nlink as follows:
CREATE file using crfile() - (genlib)
OBTAIN file status information using fstat()
VERIFY that fstat() returned 0 and errno was not set
VERIFY that the number of links to the file is one
LINK to file using link()
OBTAIN file status information using fstat()
VERIFY that fstat() returned 0 and errno was not set
VERIFY that the number of links to the file is two
CLOSE file descriptor using close()
UNLINK file
CHECK that S_ISDIR(st_mode) refers to a directory as follows:
CREATE directory using crdir()
OBTAIN file status information using fstat()
VERIFY that fstat() returned 0 and errno was not set
VERIFY that file is a directory using S_ISDIR()
WHEN not testing the XNFS specification:
CHECK that S_ISFIFO(st_mode) refers to a FIFO as follows:
CREATE FIFO using mkfifo()
OBTAIN file status information using fstat()
VERIFY that fstat() returned 0 and errno was not set
VERIFY that file is a directory using S_ISFIFO()
WHEN not testing the XNFS specification:
CHECK st_size, st_atime, st_mtime and st_ctime as follows:
CREATE pipe using pipe()
CALL fstat() to force timestamp update
OBTAIN time using time()
SLEEP for 2 seconds using sleep()
WRITE data to file using write()
CALL fstat() to force timestamp update
OBTAIN time using time()
SLEEP for 1 second using sleep()
OBTAIN file status information using fstat()
VERIFY that fstat() returned 0 and errno was not set
VERIFY that st_atime is set to the value when time() was first
called
VERIFY that st_mtime is set to the value when time() was
subsequently called
VERIFY that st_ctime is set to the value when time() was
subsequently called
CLOSE both file descriptors using close()
Test Information:
fstat() set st_atime incorrectly: expected 765934676, observed 765934675
path tracing error: path counter 6, expected 7
************************************************************************Review Information
Review Type TSMA Review Start Date null Completed null Status Complete Review Recommendation No Resolution Given Review Response
It is accepted that there is a small possibility that the atime field
could be updated slightly before the second indicated by the call to
time(). Systems are not required to update the atime field at the point
of file creation, but only to mark the field for update on a subsequent
stat() or close() operation. The system under test has decided to update
the atime immediately and this occasionaly causes a one second discrepancy.
It is recommended that this be considered to be 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 0150
- List All PRs
- Search Reports
- Email the System Administrator
- View the The Open Brand Interpretations Database User Manual
Contact the Certification Authority