Title: vfs: fs.writeFileSync(fd, ...) does not dispatch virtual file descriptors · Issue #64164 · nodejs/node · GitHub
Open Graph Title: vfs: fs.writeFileSync(fd, ...) does not dispatch virtual file descriptors · Issue #64164 · nodejs/node
X Title: vfs: fs.writeFileSync(fd, ...) does not dispatch virtual file descriptors · Issue #64164 · 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 mountPoint = fs.mkdtempSync(path.join...
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/64164
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"vfs: fs.writeFileSync(fd, ...) does not dispatch virtual file descriptors","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 mountPoint = fs.mkdtempSync(path.join(os.tmpdir(), 'vfs-mount-'));\n\nconst mounted = vfs\n .create({ emitExperimentalWarning: false })\n .mount(mountPoint);\n\ntry {\n const file = path.join(mountPoint, 'file.txt');\n\n fs.writeFileSync(file, 'abcdef');\n\n const fd = fs.openSync(file, 'r+');\n\n try {\n fs.writeFileSync(fd, 'XY');\n console.log(fs.readFileSync(file, 'utf8'));\n } catch (err) {\n console.log('threw:', err.code, err.syscall);\n } finally {\n fs.closeSync(fd);\n }\n} finally {\n mounted.unmount();\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\n```console\nXYcdef\n```\n\nNative `fs.writeFileSync(fd, data)` writes through the already-open descriptor at its current file position, so virtual fds should be dispatched the same way as `fs.readFileSync(fd)` and `fs.readSync(fd, ...)`.\n\n### What do you see instead?\n\nthrows `EBADF` with syscall `write`.\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/trivikr","@type":"Person","name":"trivikr"},"datePublished":"2026-06-27T06:45:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/64164/node/issues/64164"}
| 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:ff72a408-3221-69b3-d2d4-26948a969ae3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 96E2:31C072:549563:7294C0:6A4D3EE1 |
| html-safe-nonce | ff7832f3a53a13746a74b582cde9fef4c0d0a1542d347450cb25cfcc3f19d8f9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NkUyOjMxQzA3Mjo1NDk1NjM6NzI5NEMwOjZBNEQzRUUxIiwidmlzaXRvcl9pZCI6IjQxODAwNjM4NTMwMjk5NjU1MzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 36cb29c91a5fff3d8a406417a9447cd6f67913e1ef75467c29964612dd98c0ff |
| hovercard-subject-tag | issue:4757168009 |
| 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/64164/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a42ca396ddbecdc18e597ff7672b081c1bfad7b96f79d30504bc807aca2a7f8b/nodejs/node/issues/64164 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a42ca396ddbecdc18e597ff7672b081c1bfad7b96f79d30504bc807aca2a7f8b/nodejs/node/issues/64164 |
| 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 | 92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6 |
| 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 | 56fc8347865a14e2ec811533d68f929cf4e0ec19 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width