Trent Nelson added the comment:

Re: "how did it ever work"... on Solaris, because of the st_mtime failure, it 
doesn't even get a chance to fail on the subsequent st_atime.  I suspect the 
only platform that's exercised the utimensat() to date is Linux, and either a) 
os.stat() doesn't affect atime on Linux, b) everyone has atime disabled, c) the 
two stat calls happen quick enough that no measurable difference is observed 
against st_atime.

As for POSIX:

http://pubs.opengroup.org/onlinepubs/9699919799/toc.htm

"The fstat() function shall update any time-related fields (as described in XBD 
File Times Update ), before writing into the stat structure."

The referenced section:

4.8 File Times Update

Each file has three distinct associated timestamps: the time of last data 
access, the time of last data modification, and the time the file status last 
changed. These values are returned in the file characteristics structure struct 
stat, as described in <sys/stat.h> .

Each function or utility in POSIX.1-2008 that reads or writes data (even if the 
data does not change) or performs an operation to change file status (even if 
the file status does not change) indicates which of the appropriate timestamps 
shall be marked for update. If an implementation of such a function or utility 
marks for update one of these timestamps in a place or time not specified by 
POSIX.1-2008, this shall be documented, except that any changes caused by 
pathname resolution need not be documented. For the other functions or 
utilities in POSIX.1-2008 (those that are not explicitly required to read or 
write file data or change file status, but that in some implementations happen 
to do so), the effect is unspecified.

An implementation may update timestamps that are marked for update immediately, 
or it may update such timestamps periodically. At the point in time when an 
update occurs, any marked timestamps shall be set to the current time and the 
update marks shall be cleared. All timestamps that are marked for update shall 
be updated when the file ceases to be open by any process or before a fstat(), 
fstatat(), fsync(), futimens(), lstat(), stat(), utime(), utimensat(), or 
utimes() is successfully performed on the file. Other times at which updates 
are done are unspecified. Marks for update, and updates themselves, shall not 
be done for files on read-only file systems; see Read-Only File System .

The resolution of timestamps of files in a file system is 
implementation-defined, but shall be no coarser than one-second resolution. The 
three timestamps shall always have values that are supported by the file 
system. Whenever any of a file's timestamps are to be set to a value V 
according to the rules of the preceding paragraphs of this section, the 
implementation shall immediately set the timestamp to the greatest value 
supported by the file system that is not greater than V.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15745>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to