| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
Sorry, something went wrong.
Codecov Report❌ Patch coverage is 57.14286% with 6 lines in your changes missing coverage. Please review.
@@ Coverage Diff @@
## main #62654 +/- ##
==========================================
- Coverage 92.01% 90.33% -1.69%
==========================================
Files 379 760 +381
Lines 166972 248526 +81554
Branches 25554 46903 +21349
==========================================
+ Hits 153639 224496 +70857
- Misses 13041 15452 +2411
- Partials 292 8578 +8286
... and 600 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
|
@mcollina Sorry, I had to amend the commit to get lint-commit-message CI to pass. Mind re-approving? Thanks! 🙏 |
Sorry, something went wrong.
Commit Queue failed- Loading data for nodejs/node/pull/62654 ✔ Done loading data for nodejs/node/pull/62654 ----------------------------------- PR info ------------------------------------ Title fs: pass symlink type in cp when filter is provided (#62654) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch shulaoda:04-10-fs_pass_symlink_type_in_cp_when_filter_is_provided -> nodejs:main Labels fs, needs-ci Commits 1 - fs: pass symlink type in cp when filter is provided Committers 1 - shulaoda <165626830+shulaoda@users.noreply.github.com> PR-URL: https://github.com/nodejs/node/pull/62654 Fixes: https://github.com/nodejs/node/issues/62653 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/62654 Fixes: https://github.com/nodejs/node/issues/62653 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> -------------------------------------------------------------------------------- ℹ This PR was created on Thu, 09 Apr 2026 16:25:30 GMT ✔ Approvals: 4 ✔ - Aviv Keller (@avivkeller): https://github.com/nodejs/node/pull/62654#pullrequestreview-4084591716 ✔ - Juan José Arboleda (@juanarbol): https://github.com/nodejs/node/pull/62654#pullrequestreview-4084831882 ✔ - Stefan Stojanovic (@StefanStojanovic): https://github.com/nodejs/node/pull/62654#pullrequestreview-4103501656 ✔ - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/62654#pullrequestreview-4345294374 ✘ 10 GitHub CI job(s) failed: ✘ - github-actions: ACTION_REQUIRED ✘ - github-actions: ACTION_REQUIRED ✘ - github-actions: ACTION_REQUIRED ✘ - github-actions: ACTION_REQUIRED ✘ - github-actions: ACTION_REQUIRED ✘ - github-actions: ACTION_REQUIRED ✘ - github-actions: ACTION_REQUIRED ✘ - github-actions: ACTION_REQUIRED ✘ - github-actions: ACTION_REQUIRED ✘ - github-actions: ACTION_REQUIRED ℹ Last Full PR CI on 2026-05-22T13:09:00Z: https://ci.nodejs.org/job/node-test-pull-request/73616/ ⚠ Commits were pushed after the last Full PR CI run: ⚠ - fs: pass symlink type in cp when filter is provided - Querying data for job/node-test-pull-request/73616/ ✔ Build data downloaded ✘ Last Jenkins CI still running -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/26292186844 |
Sorry, something went wrong.
When `fs.cp`/`fs.cpSync` is called with both `verbatimSymlinks: true` and a `filter` function, directory symlinks were incorrectly created as file symlinks on Windows. Without a `filter`, cp takes the C++ fast path (`cpSyncCopyDir`) which uses `std::filesystem::copy_symlink()` and preserves the symlink type automatically. With a `filter`, the JS fallback calls `symlinkSync`/ `symlink` without a `type` argument. On Windows, that causes the type to be auto-detected by stat-ing the resolved target at the destination, but during a recursive copy the target directory may not exist yet at the destination (e.g. `linked/` is copied before `packages/` in alphabetical order). The stat fails and `type` falls back to `'file'`, producing a file symlink in place of a directory symlink. Detect the symlink type from the source (which always exists) via `internalModuleStat(src)` and pass it explicitly to the `symlinkSync`/ `symlink` call sites. `onLink` already computed `srcIsDir` for subdirectory validation; hoist that computation above the early-return paths and thread the derived `symlinkType` through `copyLink` as well. Both the sync (`cp-sync.js`) and async (`cp.js`) implementations are fixed. Add two regression tests that copy a tree containing a relative directory symlink with `verbatimSymlinks: true` and a `filter` function, then assert the destination link still resolves as a directory. Fixes: nodejs#62653 Signed-off-by: shulaoda <165626830+shulaoda@users.noreply.github.com>
Sorry, something went wrong.
When `fs.cp`/`fs.cpSync` is called with both `verbatimSymlinks: true` and a `filter` function, directory symlinks were incorrectly created as file symlinks on Windows. Without a `filter`, cp takes the C++ fast path (`cpSyncCopyDir`) which uses `std::filesystem::copy_symlink()` and preserves the symlink type automatically. With a `filter`, the JS fallback calls `symlinkSync`/ `symlink` without a `type` argument. On Windows, that causes the type to be auto-detected by stat-ing the resolved target at the destination, but during a recursive copy the target directory may not exist yet at the destination (e.g. `linked/` is copied before `packages/` in alphabetical order). The stat fails and `type` falls back to `'file'`, producing a file symlink in place of a directory symlink. Detect the symlink type from the source (which always exists) via `internalModuleStat(src)` and pass it explicitly to the `symlinkSync`/ `symlink` call sites. `onLink` already computed `srcIsDir` for subdirectory validation; hoist that computation above the early-return paths and thread the derived `symlinkType` through `copyLink` as well. Both the sync (`cp-sync.js`) and async (`cp.js`) implementations are fixed. Add two regression tests that copy a tree containing a relative directory symlink with `verbatimSymlinks: true` and a `filter` function, then assert the destination link still resolves as a directory. Fixes: #62653 Signed-off-by: shulaoda <165626830+shulaoda@users.noreply.github.com> PR-URL: #62654 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
When `fs.cp`/`fs.cpSync` is called with both `verbatimSymlinks: true` and a `filter` function, directory symlinks were incorrectly created as file symlinks on Windows. Without a `filter`, cp takes the C++ fast path (`cpSyncCopyDir`) which uses `std::filesystem::copy_symlink()` and preserves the symlink type automatically. With a `filter`, the JS fallback calls `symlinkSync`/ `symlink` without a `type` argument. On Windows, that causes the type to be auto-detected by stat-ing the resolved target at the destination, but during a recursive copy the target directory may not exist yet at the destination (e.g. `linked/` is copied before `packages/` in alphabetical order). The stat fails and `type` falls back to `'file'`, producing a file symlink in place of a directory symlink. Detect the symlink type from the source (which always exists) via `internalModuleStat(src)` and pass it explicitly to the `symlinkSync`/ `symlink` call sites. `onLink` already computed `srcIsDir` for subdirectory validation; hoist that computation above the early-return paths and thread the derived `symlinkType` through `copyLink` as well. Both the sync (`cp-sync.js`) and async (`cp.js`) implementations are fixed. Add two regression tests that copy a tree containing a relative directory symlink with `verbatimSymlinks: true` and a `filter` function, then assert the destination link still resolves as a directory. Fixes: #62653 Signed-off-by: shulaoda <165626830+shulaoda@users.noreply.github.com> PR-URL: #62654 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
| Back | FazBrowse Home | New Git URL |
When fs.cp/fs.cpSync is called with both verbatimSymlinks: true and a filter function, directory symlinks are incorrectly created as file symlinks on Windows.
Root cause
fs.cp takes two code paths:
Test
Added two test files that verify directory symlinks are preserved when copying with verbatimSymlinks: true and a filter function:
Fixes: #62653