GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fs: stat src through symlinks in cpSync() when dereference is set by yohannesjoya · Pull Request #67340 · nodejs/node

Conversation

@yohannesjoya

@yohannesjoya yohannesjoya commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

cpSync() checked src with symlink_status() when dereference was true and with status() when it was false, the reverse of what the option means. #59681 fixed the same swap for dest but left src as it was. So a symlink to a file passed as src with dereference: true was treated as a directory: cpSync() threw ERR_FS_EISDIR unless recursive was set, while fs.cp() copied the file.

This swaps the two calls and drops the check that counted a symlink as a directory, which status() can no longer return. The new test covers both cpSync() and fs.cp() and fails on main.

This is @npaun's fix from #60945, which the stale bot closed. I asked there on Oct 31 whether they planned to reopen it and got no reply, so I've rebased it and added the test, with them as co-author.

Refs: #59168

AI disclosure: I used an AI assistant to help find, test and write up this change. I reviewed and tested it myself.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@yohannesjoya @npaun
fs: stat src through symlinks in cpSync() when dereference is set
5c9f6d9
CpSyncCheckPaths() used symlink_status() for src when dereference was
true and status() when it was false, the reverse of what the option
means. nodejs#59681 fixed the same swap for dest but left src as it was.
A symlink to a file passed as src with dereference: true was treated
as a directory, so cpSync() threw ERR_FS_EISDIR unless recursive was
set, while fs.cp() copied the file.

Swap the two calls and drop the check that counted a symlink as a
directory, which status() can no longer return.

Refs: nodejs#59168
Refs: nodejs#60945
Co-authored-by: Nicholas Paun <[email protected]>
Signed-off-by: yohannesjoya <[email protected]>
@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 file-system APIs and the fs module. needs-ci PRs that need a full CI run. labels Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

  • the guide for first-time contributors
  • the contribution and automation policies
  • the pull request guide
  • the AI use policy
  • the Code of Conduct

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@yohannesjoya

yohannesjoya commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

@LiviaMedeiros this ports the fix from #60945, which you reviewed, plus the async test you asked for there. Could you take a look and start CI?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell approved these changes Nov 15, 2026
View reviewed changes
@jasnell jasnell added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 15, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 16, 2026
@nodejs-github-bot

nodejs-github-bot commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/79149/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

LiviaMedeiros
LiviaMedeiros approved these changes Nov 16, 2026
View reviewed changes
Comment thread test/parallel/test-fs-cp-dereference-symlink-to-file.mjs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@codecov

codecov Bot commented Nov 16, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.68%. Comparing base (c99ebf2) to head (5c9f6d9).
⚠️ Report is 393 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67340      +/-   ##
==========================================
- Coverage   92.99%   90.68%   -2.32%     
==========================================
  Files         428      797     +369     
  Lines      195633   279572   +83939     
  Branches    30281    53773   +23492     
==========================================
+ Hits       181937   253521   +71584     
- Misses      13369    16342    +2973     
- Partials      327     9709    +9382     
Files with missing lines Coverage Δ
src/node_file.cc 76.12% <100.00%> (ø)

... and 509 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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@yohannesjoya

yohannesjoya commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Friendly ping: two approvals and green Jenkins CI (node-test-pull-request/79149). @LiviaMedeiros I left the mustSucceed() nit out to keep the green run; happy to push it if you'd prefer it in before landing. Otherwise, could a collaborator add commit-queue? Thanks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@LiviaMedeiros LiviaMedeiros added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 24, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 85eb0c7 into nodejs:main Nov 24, 2026
79 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Landed in 85eb0c7

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 24, 2026
aduh95 pushed a commit that referenced this pull request Nov 24, 2026
@yohannesjoya @npaun @aduh95
fs: stat src through symlinks in cpSync() when dereference is set
e0921d2
CpSyncCheckPaths() used symlink_status() for src when dereference was
true and status() when it was false, the reverse of what the option
means. #59681 fixed the same swap for dest but left src as it was.
A symlink to a file passed as src with dereference: true was treated
as a directory, so cpSync() threw ERR_FS_EISDIR unless recursive was
set, while fs.cp() copied the file.

Swap the two calls and drop the check that counted a symlink as a
directory, which status() can no longer return.

Refs: #59168
Refs: #60945
Co-authored-by: Nicholas Paun <[email protected]>
Signed-off-by: yohannesjoya <[email protected]>
PR-URL: #67340
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: LiviaMedeiros <[email protected]>
@github-actions github-actions Bot mentioned this pull request Nov 24, 2026
2026-11-25, Version 27.0.0-alpha.0.2.0 (Alpha) #67757
Merged
gabylb pushed a commit to gabylb/node that referenced this pull request Nov 27, 2026
@yohannesjoya @npaun @gabylb
fs: stat src through symlinks in cpSync() when dereference is set
57a9c49
CpSyncCheckPaths() used symlink_status() for src when dereference was
true and status() when it was false, the reverse of what the option
means. nodejs#59681 fixed the same swap for dest but left src as it was.
A symlink to a file passed as src with dereference: true was treated
as a directory, so cpSync() threw ERR_FS_EISDIR unless recursive was
set, while fs.cp() copied the file.

Swap the two calls and drop the check that counted a symlink as a
directory, which status() can no longer return.

Refs: nodejs#59168
Refs: nodejs#60945
Co-authored-by: Nicholas Paun <[email protected]>
Signed-off-by: yohannesjoya <[email protected]>
PR-URL: nodejs#67340
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: LiviaMedeiros <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@LiviaMedeiros LiviaMedeiros LiviaMedeiros approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

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

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@yohannesjoya @nodejs-github-bot @jasnell @LiviaMedeiros
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.