src: make fs functions handle pre-epoch timestamps#32408
src: make fs functions handle pre-epoch timestamps#32408bnoordhuis wants to merge 3 commits intonodejs:mainfrom
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: Detailsedit2: 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 <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
`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 <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
`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 <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
`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 <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
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.