Skip to content

fix(fs): use libuv for recursive cpSync to avoid VirtioFS EACCES - #65547

Open
shoemoney wants to merge 1 commit into
nodejs:mainfrom
shoemoney:fix/cpsync-virtiofs-permission
Open

fix(fs): use libuv for recursive cpSync to avoid VirtioFS EACCES#65547
shoemoney wants to merge 1 commit into
nodejs:mainfrom
shoemoney:fix/cpsync-virtiofs-permission

Conversation

@shoemoney

Copy link
Copy Markdown

Fixes recursive cpSync EACCES on Docker VirtioFS bind mounts.

Bug: CpSyncCopyDir at src/node_file.cc:4205 uses std::filesystem::copy_file which libstdc++ implements by creating dest with 0200 then fchmod. VirtioFS blocks the 0200 creation with EACCES. Single-file path at 4015 already avoids this by using uv_fs_copyfile when mode != 0.

Fix: Use uv_fs_copyfile with mode 0 for recursive regular-file copies, preserving force, errorOnExist and skipExisting semantics via UV_FS_COPYFILE_EXCL and an exists check. Mirrors the single-file path fix.

Evidence: Verified RED before and GREEN after. All 42 test/parallel/test-fs-cp-sync* tests pass sequentially.

Fixes: #65497
Signed-off-by: Jeremy Schoemaker (jeremy@shoemoney.com)
Assisted-by: Claude

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Aug 25, 2026
Fix verified RED->GREEN. fs.cpSync recursive copy fails EACCES on
Docker VirtioFS bind mounts via std::filesystem 0200 intermediate at
node_file.cc:4205. libstdc++ creates dest with 0200 then fchmod,
VirtioFS blocks. Single-file path at 4015 correctly uses
uv_fs_copyfile when mode != 0.

Fixes: nodejs#65497
Signed-off-by: Jeremy Schoemaker <jeremy@shoemoney.com>
Assisted-by: Claude <noreply@anthropic.com>
@shoemoney
shoemoney force-pushed the fix/cpsync-virtiofs-permission branch from 0f9ffa7 to 221cfd9 Compare August 25, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fs.cpSync fails with EACCES when the destination is on a Docker bind mount (regression in 22.17)

2 participants