-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
src: make fs functions handle pre-epoch timestamps #32408
Conversation
Introduced in commit 9836cf5 ("lib: lazy instantiation of fs.Stats dates") without providing any rationale - that wasn't added until later, by someone else - and it doesn't look the least bit correct to me. It certainly makes an upcoming regression test fail because a timestamp in the deep past doesn't round-trip correctly, it's off by a fraction of a second. Refs: nodejs#32369
A wrong type cast prevented timestamps before 1970-01-01 from working with functions like `fs.stat()`. Fixes: nodejs#32369
I wonder if there's another bug hiding somewhere... edit:
edit2: the test mixes up assert.strictEqual(Y2K38_mtime, Y2K38_stats.mtime.getTime() / 1000); They should be the other way around: assert.strictEqual(Y2K38_stats.mtime.getTime() / 1000, Y2K38_mtime); I.e., edit3: opened #32420 to fix that. |
`actual` is the first argument, `expected` the second, but the test flipped them around and was producing confusing assertion messages as a result. Refs: nodejs#32408 (comment)
I might be mistaken about that because the soon-to-be-added libuv test |
`actual` is the first argument, `expected` the second, but the test flipped them around and was producing confusing assertion messages as a result. Refs: #32408 (comment) PR-URL: #32420 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
`actual` is the first argument, `expected` the second, but the test flipped them around and was producing confusing assertion messages as a result. Refs: #32408 (comment) PR-URL: #32420 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
`actual` is the first argument, `expected` the second, but the test flipped them around and was producing confusing assertion messages as a result. Refs: #32408 (comment) PR-URL: #32420 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
`actual` is the first argument, `expected` the second, but the test flipped them around and was producing confusing assertion messages as a result. Refs: #32408 (comment) PR-URL: #32420 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
8ae28ff
to
2935f72
Compare
Superseded by #43714. |
A wrong type cast prevented timestamps before 1970-01-01 from working
with functions like
fs.stat()
.Fixes: #32369
The first commit is libuv/libuv#2747. This PR can't land (at least, not without the test failing) until libuv is upgraded.