René's URL Explorer Experiment


Title: fs.cpSync fails with EACCES when the destination is on a Docker bind mount (regression in 22.17) · Issue #65497 · nodejs/node · GitHub

Open Graph Title: fs.cpSync fails with EACCES when the destination is on a Docker bind mount (regression in 22.17) · Issue #65497 · nodejs/node

X Title: fs.cpSync fails with EACCES when the destination is on a Docker bind mount (regression in 22.17) · Issue #65497 · nodejs/node

Description: Version v22.17.1 (also v22.18.0, v22.20.0, v22.23.2, v24.19.0). Last good: v22.16.0. Platform Docker Desktop on macOS (Darwin 25.5.0, arm64), default VirtioFS file sharing. Reproduced with the official node:*-slim images, so the containe...

Open Graph Description: Version v22.17.1 (also v22.18.0, v22.20.0, v22.23.2, v24.19.0). Last good: v22.16.0. Platform Docker Desktop on macOS (Darwin 25.5.0, arm64), default VirtioFS file sharing. Reproduced with the offi...

X Description: Version v22.17.1 (also v22.18.0, v22.20.0, v22.23.2, v24.19.0). Last good: v22.16.0. Platform Docker Desktop on macOS (Darwin 25.5.0, arm64), default VirtioFS file sharing. Reproduced with the offi...

Opengraph URL: https://github.com/nodejs/node/issues/65497

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"fs.cpSync fails with EACCES when the destination is on a Docker bind mount (regression in 22.17)","articleBody":"### Version\n\nv22.17.1 (also v22.18.0, v22.20.0, v22.23.2, v24.19.0). Last good: **v22.16.0**.\n\n### Platform\n\nDocker Desktop on macOS (Darwin 25.5.0, arm64), default VirtioFS file sharing. Reproduced with the official `node:*-slim` images, so the container distro is Debian bookworm.\n\n### Subsystem\n\nfs\n\n### What steps will reproduce the bug?\n\n`fs.cpSync(src, dest, { recursive: true })` throws `EACCES` when `dest` is on a Docker bind mount. The same call succeeds on 22.16.0, and on 22.17.1 it succeeds when `dest` is on the container's own filesystem.\n\nOn a macOS host:\n\n```bash\nmkdir -p /tmp/repro/src/nested\nprintf 'a' > /tmp/repro/src/file.txt\nprintf 'b' > /tmp/repro/src/nested/inner.txt\n\nfor V in 22.16 22.17; do\n  docker run --rm -v /tmp/repro:/mnt/repro -w /mnt/repro node:$V-slim node -e \"\nconst fs = require('fs');\nconst dest = 'out-' + process.version.replace(/[^0-9]/g, '_');\ntry { fs.cpSync('src', dest, { recursive: true }); console.log(process.version, 'OK'); }\ncatch (e) { console.log(process.version, 'FAIL', e.code, e.syscall, e.path); }\n\"\ndone\n```\n\nOutput:\n\n```\nv22.16.0 OK\nv22.17.1 FAIL EACCES cp out-_22_17_1\n```\n\n### How often does it reproduce?\n\nEvery time, on every version from 22.17.1 onward that I tested.\n\n### What is the expected behavior?\n\n`cpSync` copies the tree, as it does on 22.16.0 and as `cp -R` does on the same path in the same container.\n\n### What do you see instead?\n\n```\nError: EACCES: permission denied, cp 'out-_22_17_1'\n```\n\n### Additional information\n\n**This is not a permission problem.** In a single container run on 22.17.1, with the bind mount as CWD:\n\n```\nnode v22.17.1\n  FAIL dest on bind mount        EACCES cp bind-dest\n  OK   dest on container fs\n  control: id=0 access(W_OK)=yes\n  control: mkdirSync on bind mount OK\n  control: copyFileSync on bind mount OK\n  control: cp -R OK\n```\n\nSo, on the very path that `cpSync` rejects:\n\n- the process is **root** (uid 0) — it also fails as a non-root uid matching the host owner;\n- `fs.accessSync(dir, W_OK)` succeeds;\n- `fs.mkdirSync` succeeds;\n- `fs.copyFileSync` succeeds;\n- coreutils `cp -R` succeeds;\n- `fs.cpSync` with the **same source** and a destination on the container's own filesystem succeeds.\n\nOnly the combination of `cpSync` + a bind-mount destination fails.\n\n`cpSync` does partially complete before throwing: the destination directory is created and at least one entry is copied, so a retry then sees `EEXIST`/`ENOTEMPTY`. That makes the failure messy to recover from in a build pipeline.\n\n**Bisect** (identical mount, source, destination and uid; only the Node binary varies):\n\n| Version | Result |\n| ------- | ------ |\n| 22.13.1 | OK |\n| 22.14.0 | OK |\n| 22.16.0 | OK |\n| 22.17.1 | EACCES |\n| 22.18.0 | EACCES |\n| 22.20.0 | EACCES |\n| 22.23.2 | EACCES |\n| 24.19.0 | EACCES |\n\nThe boundary lines up with the C++ reimplementation of `cpSync`, which landed in 22.17. The mechanism is below.\n\n**Real-world impact.** `@nx/next:build` finishes by copying the app's `public/` directory into its output path with exactly this call:\n\n```js\ncpSync(join(projectRoot, 'public'), join(options.outputPath, 'public'), {\n  dereference: true,\n  recursive: true,\n});\n```\n\nAny Next.js build run inside a container against a bind-mounted workspace therefore fails on Node ≥ 22.17 — after the build has already compiled and typechecked successfully, so it presents as a mysterious late-stage permission error rather than an obvious environment problem. Related historical regressions in the same function: #54285, #54782.\n\n**Root cause.** Reduced to raw syscalls in the container, as root:\n\n```\nFAIL open dest O_WRONLY|O_CREAT|O_TRUNC mode 0200   errno=13 (Permission denied)\nOK   open dest O_WRONLY|O_CREAT|O_TRUNC mode 0644\nFAIL reopen the 0200 file O_WRONLY                  errno=13 (Permission denied)\n```\n\nlibstdc++'s `do_copy_file` creates the destination with `S_IWUSR` (0200) and `fchmod`s it to the source's mode afterwards. This mount refuses to open a mode-0200 file for writing, so the create fails. `uv_fs_copyfile` creates the destination with the source's mode and is unaffected.\n\nThat is confirmed outside Node entirely — plain C++ with gcc 14 and libstdc++, same mount:\n\n```\nFAIL copy_file  mount -> mount   value=13 msg=Permission denied\nOK   copy_file  mount -> /tmp\nOK   copy_file  /tmp  -> /tmp\nFAIL copy_file  /tmp  -> mount   value=13 msg=Permission denied\n```\n\n**Which is why `cpSync` is inconsistent with itself**, on one mount in one process:\n\n| Call | Result | Path taken |\n| ---- | ------ | ---------- |\n| `cpSync(file, newDest)` | OK | JS falls through to `copyFileSync` (libuv) |\n| `cpSync(file, existingDest)` | EACCES | `CpSyncOverrideFile`, `mode == 0` branch |\n| `cpSync(dirWithAFile, dest)` | EACCES | `CpSyncCopyDir`, regular-file branch |\n| `cpSync(dirNoFiles, dest)` | OK | no file is ever copied |\n\n`fs.copyFileSync` works on this mount because it uses `uv_fs_copyfile`. Both failing paths already have a libuv sibling in `node_file.cc`; they just do not take it.\n\n**Workaround.** Pin to 22.16.x, or arrange for the destination to live on the container's own filesystem rather than the bind mount.","author":{"url":"https://github.com/mnaimfaizy","@type":"Person","name":"mnaimfaizy"},"datePublished":"2026-08-23T01:37:39Z","url":"https://github.com/nodejs/node/issues/65497"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:94b4ae4b-f93d-3f2a-ad7d-79684a6e4510
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD9B6:197704:C5165D:10082F9:6AED4AB0
html-safe-nonce1b473a42eab1c8474e6642c685bd623e2b09b6ed1afa0f99a35ca5b201388236
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOUI2OjE5NzcwNDpDNTE2NUQ6MTAwODJGOTo2QUVENEFCMCIsInZpc2l0b3JfaWQiOiI4Nzc3OTk2NzE2MTcxMTUyMDQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac463edb181879d22b541236ab36beab77188a23e028301df4926566672ecd426b
hovercard-subject-tagissue:5224809219
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/65497/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5310ba6d40a1f5f9a42fb18057f46ab53fd2f71500f5e81aa35c50f477cf2718/nodejs/node/issues/65497
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5310ba6d40a1f5f9a42fb18057f46ab53fd2f71500f5e81aa35c50f477cf2718/nodejs/node/issues/65497
og:image:altVersion v22.17.1 (also v22.18.0, v22.20.0, v22.23.2, v24.19.0). Last good: v22.16.0. Platform Docker Desktop on macOS (Darwin 25.5.0, arm64), default VirtioFS file sharing. Reproduced with the offi...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemnaimfaizy
hostnamegithub.com
expected-hostnamegithub.com
None56fb42677ae87ed3e64410323d67980aa65d0485568a7858f874e7edfc6d1c11
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9c9a37e2423ed382cf39f70b5aa4b4858b40a3b0
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/65497#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F65497
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F65497
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/65497
Reloadhttps://github.com/nodejs/node/issues/65497
Reloadhttps://github.com/nodejs/node/issues/65497
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues654 (654)https://github.com/nodejs/node/issues
Pull requests662 (662)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65497
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65497
#65547https://github.com/nodejs/node/pull/65547
fs.cpSync fails with EACCES when the destination is on a Docker bind mount (regression in 22.17)https://github.com/nodejs/node/issues/65497#top
#65547https://github.com/nodejs/node/pull/65547
https://github.com/mnaimfaizy
mnaimfaizyhttps://github.com/mnaimfaizy
on Aug 23, 2026https://github.com/nodejs/node/issues/65497#issue-5224809219
#54285https://github.com/nodejs/node/issues/54285
#54782https://github.com/nodejs/node/issues/54782
https://github.com/mnaimfaizy
mnaimfaizyhttps://github.com/mnaimfaizy
on Aug 23, 2026https://github.com/nodejs/node/issues/65497#issuecomment-5383744174
shoemoneyhttps://github.com/shoemoney
on Aug 25, 2026https://github.com/nodejs/node/issues/65497#event-30008606382
fs: use libuv for recursive cpSync to avoid VirtioFS EACCEShttps://github.com/shoemoney/node/commit/221cfd951a0282588b0065cd3275bf611e76d1dd
221cfd9https://github.com/shoemoney/node/commit/221cfd951a0282588b0065cd3275bf611e76d1dd
shoemoneyhttps://github.com/shoemoney
on Sep 8, 2026https://github.com/nodejs/node/issues/65497#event-30783275579
fs: use libuv for recursive cpSync to avoid VirtioFS EACCEShttps://github.com/shoemoney/node/commit/be00f607b4389c8676ba0ab3bcec288423372a1d
be00f60https://github.com/shoemoney/node/commit/be00f607b4389c8676ba0ab3bcec288423372a1d
fs: use libuv for recursive cpSync to avoid VirtioFS EACCEShttps://github.com/shoemoney/node/commit/e2396c6ff6f6b584ff247405f726fe06cab5ccee
e2396c6https://github.com/shoemoney/node/commit/e2396c6ff6f6b584ff247405f726fe06cab5ccee
fs: use libuv for recursive cpSync to avoid VirtioFS EACCEShttps://github.com/shoemoney/node/commit/69470d16770a0491b23190aa678fdf8c2f94c63d
69470d1https://github.com/shoemoney/node/commit/69470d16770a0491b23190aa678fdf8c2f94c63d
tdcinazhttps://github.com/tdcinaz
on Sep 22, 2026https://github.com/nodejs/node/issues/65497#event-31618408437
Fix pretest: avoid fs.cpSync recursive copy (EACCES on virtiofs/Docke…https://github.com/tdcinaz/vscode-tlaplus/commit/e7639eff8f710e78bbef30a5c585a0cd5034fca0
e7639efhttps://github.com/tdcinaz/vscode-tlaplus/commit/e7639eff8f710e78bbef30a5c585a0cd5034fca0
https://github.com/tfaller
tfallerhttps://github.com/tfaller
on Oct 8, 2026https://github.com/nodejs/node/issues/65497#issuecomment-6059101887
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/65497
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65497
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.