fix(fs): use libuv for recursive cpSync to avoid VirtioFS EACCES - #65547
fix(fs): use libuv for recursive cpSync to avoid VirtioFS EACCES#65547shoemoney wants to merge 1 commit into
Conversation
0f9ffa7 to
221cfd9
Compare
7f3d0f5 to
be00f60
Compare
|
Rebased onto main. CopyDirRecursive() was refactored upstream since this PR was opened: it is now the single implementation shared by fs.cpSync() and the thread-pool fs.cp() job, with a new fresh_destination path used only by fs.cp(). The EACCES bug is still present on the merge-into-existing-directory path, which is the one fs.cpSync() takes, so the fix now lives in CopyDirRecursive()'s regular-file branch instead of directly in CpSyncCopyDir(). Same approach as before: uv_fs_copyfile() instead of std::filesystem::copy_file(), preserving force, errorOnExist and skip-existing semantics via UV_FS_COPYFILE_EXCL and an existence check. |
be00f60 to
e2396c6
Compare
Codecov Reportβ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #65547 +/- ##
==========================================
+ Coverage 90.16% 90.17% +0.01%
==========================================
Files 771 771
Lines 265445 265451 +6
Branches 50455 50458 +3
==========================================
+ Hits 239329 239373 +44
+ Misses 17056 17009 -47
- Partials 9060 9069 +9
π New features to boost your workflow:
|
|
All tests are failing in CI. They will continue to fail without the commit from PR #65921. Please rebase the branch in this PR according to the Pull requests documentation so that your PR branch includes the fix. It is also advisable before pushing any commit to test it locally, see Pull requests > Step 6: Test
with further details under BUILDING > Running tests. including:
|
fs.cpSync() recursive copy fails EACCES on Docker VirtioFS bind mounts. CopyDirRecursive()'s regular-file branch calls std::filesystem::copy_file(), which libstdc++ implements by creating dest with mode 0200 and then fchmod(). VirtioFS rejects that initial 0200 open with EACCES. The single-file cpSync path and the fresh-destination branch of CopyDirRecursive() already avoid this by using uv_fs_copyfile(), which opens dest with its final mode directly. Use uv_fs_copyfile() for the merge-into-existing-directory case too, preserving force, errorOnExist and skip-existing semantics via UV_FS_COPYFILE_EXCL and an existence check. Also drops the file_copy_opts capture, now unused once the regular-file branch no longer calls std::filesystem::copy_file(). Fixes: nodejs#65497 Signed-off-by: Jeremy Schoemaker <jeremy@shoemoney.com>
e2396c6 to
69470d1
Compare
|
Rebased onto Thanks for the pointer to #65921 β that explains the full red board, since every job was failing in the workflow YAML before it ever reached the test suite. |
|
CI on the rebased head (
That is an inspector/debugger timeout, and this patch only touches Everything else is passing: I do not have permission to re-run jobs on this repo β happy to push an empty commit to retrigger if that is preferred. |
An empty commit would not trigger a re-run, so long as you are classed as a "first-time contributor", in which case every GitHub Actions CI run has to be manually triggered by a Node.js team member. I have re-run the failing test, and now the GitHub Actions CI is green. The next step depends on a technical review of your PR. It's not possible to predict how long that will take. |
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)