Title: vfs: lchown follows symlinks instead of updating the link · Issue #64572 · nodejs/node · GitHub
Open Graph Title: vfs: lchown follows symlinks instead of updating the link · Issue #64572 · nodejs/node
X Title: vfs: lchown follows symlinks instead of updating the link · Issue #64572 · nodejs/node
Description: Version main Platform macOS 26.5.2 Subsystem vfs What steps will reproduce the bug? import fs from 'node:fs'; import path from 'node:path'; import vfs from 'node:vfs'; const mountPoint = path.resolve(`/tmp/vfs-lchown-${process.pid}`); co...
Open Graph Description: Version main Platform macOS 26.5.2 Subsystem vfs What steps will reproduce the bug? import fs from 'node:fs'; import path from 'node:path'; import vfs from 'node:vfs'; const mountPoint = path.resol...
X Description: Version main Platform macOS 26.5.2 Subsystem vfs What steps will reproduce the bug? import fs from 'node:fs'; import path from 'node:path'; import vfs from 'node:vfs'; const...
Opengraph URL: https://github.com/nodejs/node/issues/64572
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"vfs: lchown follows symlinks instead of updating the link","articleBody":"### Version\n\nmain\n\n### Platform\n\n```text\nmacOS 26.5.2\n```\n\n### Subsystem\n\nvfs\n\n### What steps will reproduce the bug?\n\n```js\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport vfs from 'node:vfs';\n\nconst mountPoint = path.resolve(`/tmp/vfs-lchown-${process.pid}`);\n\nconst virtualFs = vfs.create({ emitExperimentalWarning: false });\nvirtualFs.writeFileSync('/target.txt', 'target');\nvirtualFs.symlinkSync('/target.txt', '/link.txt');\nvirtualFs.mount(mountPoint);\n\nfs.lchownSync(path.join(mountPoint, 'link.txt'), 123, 456);\n\nvirtualFs.unmount();\n\nconst targetStats = virtualFs.lstatSync('/target.txt');\nconst linkStats = virtualFs.lstatSync('/link.txt');\n\nconsole.log({\n target: { uid: targetStats.uid, gid: targetStats.gid },\n link: { uid: linkStats.uid, gid: linkStats.gid },\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\n{\n target: { uid: 0, gid: 0 },\n link: { uid: 123, gid: 456 }\n}\n```\n\n`lchown` should not follow the symlink; it should update the symlink’s own metadata and leave the target unchanged.\n\n### What do you see instead?\n\n```console\n{\n target: { uid: 123, gid: 456 },\n link: { uid: 0, gid: 0 }\n}\n```\n\n`fs.lchownSync()` updates the symlink target’s uid/gid while the symlink itself remains unchanged.\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/trivikr","@type":"Person","name":"trivikr"},"datePublished":"2026-07-18T07:25:31Z","url":"https://github.com/nodejs/node/issues/64572"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| 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:c4fc9f65-50d2-261a-2e6f-3bc91a2c2ba8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C9C8:284A23:35C04:49031:6AED309E |
| html-safe-nonce | fd145b06a16d9cc188347ed1114cd288abbb4432ae8f9126437103ebc785136e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOUM4OjI4NEEyMzozNUMwNDo0OTAzMTo2QUVEMzA5RSIsInZpc2l0b3JfaWQiOiI3MzQxNzAyOTI0NDYwNjk5ODA2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d71bacf4dcf40f485c649b9e072d2b66184cb9bae6039391b9cc00abe8daa34e |
| hovercard-subject-tag | issue:4917282913 |
| 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/64572/issue_layout |
| twitter:image | https://opengraph.githubassets.com/35f9b939b0495b2e3674e9d94829c4b3b31fd0c70422a009875d9f5263acfe0a/nodejs/node/issues/64572 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/35f9b939b0495b2e3674e9d94829c4b3b31fd0c70422a009875d9f5263acfe0a/nodejs/node/issues/64572 |
| og:image:alt | Version main Platform macOS 26.5.2 Subsystem vfs What steps will reproduce the bug? import fs from 'node:fs'; import path from 'node:path'; import vfs from 'node:vfs'; const mountPoint = path.resol... |
| 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 | e51d0b7b5ab34b1688c05b54c3ed17b8658b2fa9bca973a9c740683ccb12cf4a |
| 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 | 59ebb7b901cc154ecc179a44f266fcf69f343b30 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width