Title: vfs: RealFSProvider readFileSync(fd) fails after backing file is renamed · Issue #64103 · nodejs/node · GitHub
Open Graph Title: vfs: RealFSProvider readFileSync(fd) fails after backing file is renamed · Issue #64103 · nodejs/node
X Title: vfs: RealFSProvider readFileSync(fd) fails after backing file is renamed · Issue #64103 · nodejs/node
Description: Version main Platform macOS 26.5.0 Subsystem vfs What steps will reproduce the bug? import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import vfs from 'node:vfs'; const realRoot = fs.mkdtempSync(path.join(o...
Open Graph Description: Version main Platform macOS 26.5.0 Subsystem vfs What steps will reproduce the bug? import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import vfs from 'node:vfs'; con...
X Description: Version main Platform macOS 26.5.0 Subsystem vfs What steps will reproduce the bug? import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import ...
Opengraph URL: https://github.com/nodejs/node/issues/64103
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"vfs: RealFSProvider readFileSync(fd) fails after backing file is renamed","articleBody":"### Version\n\nmain\n\n### Platform\n\n```text\nmacOS 26.5.0\n```\n\n### Subsystem\n\nvfs\n\n### What steps will reproduce the bug?\n\n```js\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport vfs from 'node:vfs';\n\nconst realRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'vfs-real-root-'));\nconst mountPoint = fs.mkdtempSync(path.join(os.tmpdir(), 'vfs-mount-'));\n\nconst mounted = vfs\n .create(new vfs.RealFSProvider(realRoot), { emitExperimentalWarning: false })\n .mount(mountPoint);\n\ntry {\n fs.writeFileSync(path.join(realRoot, 'a.txt'), 'still readable');\n\n const fd = fs.openSync(path.join(mountPoint, 'a.txt'), 'r');\n fs.renameSync(path.join(realRoot, 'a.txt'), path.join(realRoot, 'b.txt'));\n\n try {\n console.log(fs.readFileSync(fd, 'utf8'));\n } finally {\n fs.closeSync(fd);\n }\n} finally {\n mounted.unmount();\n fs.rmSync(realRoot, { recursive: true, force: true });\n fs.rmSync(mountPoint, { recursive: true, force: true });\n}\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways\n\n### What is the expected behavior? Why is that the expected behavior?\n\nIt should print `still readable`. An already-open `fd` should remain usable after the file is renamed, matching native filesystem behavior.\n\n### What do you see instead?\n\n`fs.readFileSync(fd, 'utf8')` throws `ENOENT` after the backing file is renamed. This shows RealFSProvider is trying to read through the original path.\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/trivikr","@type":"Person","name":"trivikr"},"datePublished":"2026-06-24T01:05:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/64103/node/issues/64103"}
| 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:149b2ff3-670e-7b38-9a69-fc49249b520e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A16E:247EB:15543B5:1CD769F:6A4D77F3 |
| html-safe-nonce | 5d8a6bc324a5f98d4be42d3357206be724b872cf3b418bae361bd4e9a8183d52 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTZFOjI0N0VCOjE1NTQzQjU6MUNENzY5Rjo2QTRENzdGMyIsInZpc2l0b3JfaWQiOiI0MDI5Nzc1MTE3NjE3NTU5NTM5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d218fe7fb6adc4710b1532b8c3e9f28f98ed87642bde6fe7055f2bbe4cb0a8e9 |
| hovercard-subject-tag | issue:4730754585 |
| 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/64103/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a70b017641283203e7e0f0545790bc020ecb058176f8c9cc9935c2f687478859/nodejs/node/issues/64103 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a70b017641283203e7e0f0545790bc020ecb058176f8c9cc9935c2f687478859/nodejs/node/issues/64103 |
| og:image:alt | Version main Platform macOS 26.5.0 Subsystem vfs What steps will reproduce the bug? import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import vfs from 'node:vfs'; con... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | trivikr |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7f8e15305e2ab58890ca84b830615e375f5df303cf471cafcba0c08272981be3 |
| 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 | 8608b0750fc35e283e5ec5b094bff942d7a0e197 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width