Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behavior on Windows from deprecated st_ctime_ns stat #87

Open
sneakers-the-rat opened this issue Nov 22, 2023 · 0 comments
Labels
bug Something isn't working os-windows Windows OS specific issues

Comments

@sneakers-the-rat
Copy link

didn't know this was yours as well!

Noticed that only the windows tests were failing here for a circumstance where a cache should have been invalidated because the creation time, but not the mtime was changed: dandi/dandi-cli#1364

i think this comes from here: https://github.com/con/fscacher/blob/e3a6dee365f89a3b0212d19976e61a8165bf0488/src/fscacher/cache.py#L209C10-L209C10

where a fingerprint is generated for a file using s.st_mtime_ns, s.st_ctime_ns, s.st_size, s.st_ino

st_ctime_ns is deprecated on windows:

In 3.12:

Changed in version 3.12: st_ctime_ns is deprecated on Windows. Use st_birthtime_ns for the file creation time. In the future, st_ctime will contain the time of the most recent metadata change, as for other platforms.

In 3.11:

Platform dependent:
the time of most recent metadata change on Unix,
the time of creation on Windows, expressed in nanoseconds as an integer.

It's not clear to me how one would reconcile them since the 'get last metadata change' behavior isn't available in windows, but the docs say it should be 'in the future.'

In the meantime it might be good to add a small ~1kb hash from the front and back of a file or something in the fingerprint.

mostly raising the issue to bring it to attention, doesn't seem like an urgent problem, but seems good to note when OS inconsistencies arise.

@jwodder jwodder added the bug Something isn't working label Nov 22, 2023
@jwodder jwodder changed the title [bug] Inconsistent behavior on Windows from deprecated st_ctime_ns stat Inconsistent behavior on Windows from deprecated st_ctime_ns stat Nov 22, 2023
@yarikoptic yarikoptic added the os-windows Windows OS specific issues label Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working os-windows Windows OS specific issues
Projects
None yet
Development

No branches or pull requests

3 participants