Skip to content

fs: fix cp, cpSync handle existing symlinks #58476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

jakecastelli
Copy link
Member

Fixes: #58468

@nodejs-github-bot nodejs-github-bot added fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels May 27, 2025
@jakecastelli jakecastelli marked this pull request as draft May 27, 2025 03:12
Copy link

codecov bot commented May 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.22%. Comparing base (44a5375) to head (cde63b2).
Report is 103 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #58476      +/-   ##
==========================================
+ Coverage   90.19%   90.22%   +0.03%     
==========================================
  Files         635      635              
  Lines      187394   187608     +214     
  Branches    36800    36857      +57     
==========================================
+ Hits       169014   169265     +251     
+ Misses      11134    11133       -1     
+ Partials     7246     7210      -36     
Files with missing lines Coverage Δ
lib/internal/fs/cp/cp-sync.js 92.20% <100.00%> (+0.06%) ⬆️
lib/internal/fs/cp/cp.js 91.19% <100.00%> (+0.87%) ⬆️

... and 40 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jakecastelli jakecastelli marked this pull request as ready for review May 27, 2025 15:54
Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! thanks for the fix @jakecastelli 🫶

By the way, could you please rebase this to the latest main and basically revert the changes I made here? 🙂 #58472

@dario-piotrowicz
Copy link
Member

dario-piotrowicz commented May 27, 2025

I don't think that this PR fully addresses #58468 since the issue mentions the bug both in cp and cpSync, @jakecastelli could you solve the bug in both functions? 🙂 (or alternatively I can split the issue into two if you prefer?)

@jakecastelli
Copy link
Member Author

Thanks for the pointer, I was a bit running late last night and didn't pay close attention to the cp repo code, I have fixed both places with newly added tests, and reverted 52430b9 🙏 PTAL

@jakecastelli jakecastelli added the commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. label May 28, 2025
Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! thanks a lot again @jakecastelli 🙏

I just left a couple of comments about the tests comments, I hope those can be addressed before landing this 🙂🙏

@dario-piotrowicz dario-piotrowicz added the request-ci Add this label to start a Jenkins CI on a PR. label May 28, 2025
@github-actions github-actions bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels May 28, 2025

This comment was marked as outdated.

@jakecastelli jakecastelli removed the request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. label May 28, 2025
@dario-piotrowicz dario-piotrowicz added the request-ci Add this label to start a Jenkins CI on a PR. label May 28, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 28, 2025
@nodejs-github-bot
Copy link
Collaborator

@jakecastelli jakecastelli added request-ci Add this label to start a Jenkins CI on a PR. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels May 29, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 29, 2025
@nodejs-github-bot
Copy link
Collaborator

@jakecastelli jakecastelli changed the title fs: fix cpSync handle existing symlinks fs: fix cp, cpSync handle existing symlinks Jun 7, 2025
@jakecastelli jakecastelli added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 7, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 7, 2025
@nodejs-github-bot
Copy link
Collaborator

Landed in 0c6e16b...68bac3d

nodejs-github-bot pushed a commit that referenced this pull request Jun 7, 2025
This reverts commit 52430b9.

PR-URL: #58476
Fixes: #58468
Reviewed-By: Dario Piotrowicz <dario.piotrowicz@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Jun 7, 2025
PR-URL: #58476
Fixes: #58468
Reviewed-By: Dario Piotrowicz <dario.piotrowicz@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Jun 7, 2025
PR-URL: #58476
Fixes: #58468
Reviewed-By: Dario Piotrowicz <dario.piotrowicz@gmail.com>
targos pushed a commit that referenced this pull request Jun 7, 2025
This reverts commit 52430b9.

PR-URL: #58476
Fixes: #58468
Reviewed-By: Dario Piotrowicz <dario.piotrowicz@gmail.com>
targos pushed a commit that referenced this pull request Jun 7, 2025
PR-URL: #58476
Fixes: #58468
Reviewed-By: Dario Piotrowicz <dario.piotrowicz@gmail.com>
targos pushed a commit that referenced this pull request Jun 7, 2025
PR-URL: #58476
Fixes: #58468
Reviewed-By: Dario Piotrowicz <dario.piotrowicz@gmail.com>
@aduh95 aduh95 added the backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. label Jun 10, 2025
@aduh95
Copy link
Contributor

aduh95 commented Jun 10, 2025

test/parallel/test-fs-cp.mjs is crashing on v22.x-staging with this change

@dario-piotrowicz
Copy link
Member

dario-piotrowicz commented Jun 10, 2025

@aduh95 do you think we could/should just revert the change only for v22?

@aduh95
Copy link
Contributor

aduh95 commented Jun 10, 2025

@dario-piotrowicz it will be included only if we can build and the tests are passing. If it's not worth backporting, we should add the dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. instead

@dario-piotrowicz
Copy link
Member

@dario-piotrowicz it will be included only if we can build and the tests are passing.

got it, thanks 🙂👍

If it's not worth backporting, we should add the dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. instead

Sorry you're right, I was asking more in the sense of this being a small bug fix, so if it were problematic in v22 we could avoid the backport, but yeah ideally it should land in v22 as well...

seriousme pushed a commit to seriousme/node that referenced this pull request Jun 10, 2025
This reverts commit 52430b9.

PR-URL: nodejs#58476
Fixes: nodejs#58468
Reviewed-By: Dario Piotrowicz <dario.piotrowicz@gmail.com>
seriousme pushed a commit to seriousme/node that referenced this pull request Jun 10, 2025
PR-URL: nodejs#58476
Fixes: nodejs#58468
Reviewed-By: Dario Piotrowicz <dario.piotrowicz@gmail.com>
seriousme pushed a commit to seriousme/node that referenced this pull request Jun 10, 2025
PR-URL: nodejs#58476
Fixes: nodejs#58468
Reviewed-By: Dario Piotrowicz <dario.piotrowicz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. 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.

cp and cpSync incorrectly handle existing dest symlinks
5 participants