On 19Oct2020 1652, Gregory P. Smith wrote:
I'm sure this is covered in MSDN. Linking to that if it has it in a
concise explanation would make sense from a note in our docs.
Probably unlikely :) I'm pretty sure this started "perfect" and was then
wound back to improve performance. But it's almost certainly an option
somewhere, which means you can't rely on it being either true nor false.
You just have to be explicit for certain pieces of information.
If I'm understanding Steve correctly this is due to Windows/NTFS storing
the access time potentially redundantly in two different places. One
within the directory entry itself and one with the file's own metadata.
Those of us with a traditional posix filesystem background may raise
eyeballs at this duplication, seeing a directory as a place that merely
maps names to inodes with the inode structure (equiv: file entry
metadata) being the sole source of truth. Which ones get updated when
and by what actions is up to the OS.
So yes, just document the "quirk" as an intended OS behavior. This is
one reason scandir() can return additional information on windows vs
what it can return on posix. The entire point of scandir() is to return
as much as possible from the directory without triggering reads of the
inodes/file-entry-metadata. :)
Yeah, I'd document it as a quirk of scandir. There's also a race where
if you scandir(), then someone touches the file, then you look at the
cached stat you get the wrong information too (an any platform). Making
clearer that it's for non-time sensitive queries is most accurate,
though we could also give an example of "access times may not be up to
date depending on OS-level caching" without committing us to being
responsible for OS decisions.
Cheers,
Steve
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/EBWUDEQEPRWJN36FLUUJQWP5EWLPWRPD/
Code of Conduct: http://python.org/psf/codeofconduct/