Title: fs: incorrect handling of numeric times from before the unix epoch · Issue #64597 · nodejs/node · GitHub
Open Graph Title: fs: incorrect handling of numeric times from before the unix epoch · Issue #64597 · nodejs/node
X Title: fs: incorrect handling of numeric times from before the unix epoch · Issue #64597 · nodejs/node
Description: Version v22.16.0 Platform Linux johnp-pc 7.1.3-200.fc44.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Jul 4 19:20:12 UTC 2026 x86_64 GNU/Linux Subsystem node:fs What steps will reproduce the bug? Description Since 1f842c2, NodeJS internally modifies...
Open Graph Description: Version v22.16.0 Platform Linux johnp-pc 7.1.3-200.fc44.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Jul 4 19:20:12 UTC 2026 x86_64 GNU/Linux Subsystem node:fs What steps will reproduce the bug? Description S...
X Description: Version v22.16.0 Platform Linux johnp-pc 7.1.3-200.fc44.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Jul 4 19:20:12 UTC 2026 x86_64 GNU/Linux Subsystem node:fs What steps will reproduce the bug? Description S...
Opengraph URL: https://github.com/nodejs/node/issues/64597
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"fs: incorrect handling of numeric times from before the unix epoch","articleBody":"### Version\n\nv22.16.0\n\n### Platform\n\n```text\nLinux johnp-pc 7.1.3-200.fc44.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Jul 4 19:20:12 UTC 2026 x86_64 GNU/Linux\n```\n\n### Subsystem\n\nnode:fs\n\n### What steps will reproduce the bug?\n\n#### Description\n\nSince https://github.com/nodejs/node/commit/1f842c2c613545ba69ad5b9ab48c49ac1f77d8d3, NodeJS internally modifies numeric negative utimes to the current time. This is unexpected, as negative strings (\"-1\") work as expected. This issue was [previously reported](https://github.com/nodejs/node/issues/14017), but not all possible types (date, string, number) were considered. and the bug therefore wrongly closed.\n\n#### Reproducer\n\n```js\nimport fs from 'node:fs';\n\nconst file = 'neg_timespec.txt';\nfs.writeFileSync(file, 'test');\n\n// Set time to -1 second before 1970\nfs.utimesSync(file, -1, -1);\n\nconst stats = fs.statSync(file);\nconsole.log(\"Expected mtime (ms): -1000\");\nconsole.log(\"Actual mtime (ms): \", stats.mtime.getTime());\n\nfs.unlinkSync(file);\n```\n\n### Incorrect code\n\nhttps://github.com/nodejs/node/blob/4f844f4380a143d0c24b39d1df34b187b06619ae/lib/internal/fs/utils.js#L783-L793\n\n### How often does it reproduce? Is there a required condition?\n\n100%\n\n### What is the expected behavior? Why is that the expected behavior?\n\nExpected mtime (ms): -1500\n\n\n### What do you see instead?\n\nActual mtime (ms): 1784465433024\n\n### Additional information\n\nFound investigating the Rust port of Bun, where the bug was copied by AI presumably.","author":{"url":"https://github.com/johnp","@type":"Person","name":"johnp"},"datePublished":"2026-07-19T12:56:29Z","url":"https://github.com/nodejs/node/issues/64597"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c36dfa9a-f6ce-6a06-74bb-8e373a3d363d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DFD0:35D623:111260:17EE58:6AFBEC8C |
| html-safe-nonce | 3f65c26e0668f33a1b0b0e2b63ad412714cdfe0384e431e556e3f3dfa90eff55 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERkQwOjM1RDYyMzoxMTEyNjA6MTdFRTU4OjZBRkJFQzhDIiwidmlzaXRvcl9pZCI6IjMzNDQ3MjM0ODMxMTUxMjE4MDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b125021c9cd2b2b433c0a1da88512a06922c15f9af3bb57d3c221e8e8bd1dd35 |
| hovercard-subject-tag | issue:4922748277 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/64597/issue_layout |
| twitter:image | https://opengraph.githubassets.com/87a9aabc8ff526b6d3314e165facc1e3c7a1bed4264281775e066deb214c54da/nodejs/node/issues/64597 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/87a9aabc8ff526b6d3314e165facc1e3c7a1bed4264281775e066deb214c54da/nodejs/node/issues/64597 |
| og:image:alt | Version v22.16.0 Platform Linux johnp-pc 7.1.3-200.fc44.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Jul 4 19:20:12 UTC 2026 x86_64 GNU/Linux Subsystem node:fs What steps will reproduce the bug? Description S... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | johnp |
| hostname | github.com |
| expected-hostname | github.com |
| None | 744d4381b1c4dbd6d8736c7d7e5bbe7dc11217584e457a3555020c631764e8ec |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | df859c48a4c8b4c0009c19bb4e82101aacb4b998 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width