Skip to content

fs: fix buffer input with recursive mode on readdir - #59220

Open
himself65 wants to merge 1 commit into
nodejs:mainfrom
himself65:himself65/2025/07/26/buffer
Open

fs: fix buffer input with recursive mode on readdir#59220
himself65 wants to merge 1 commit into
nodejs:mainfrom
himself65:himself65/2025/07/26/buffer

Conversation

@himself65

Copy link
Copy Markdown
Member

Fixes: #58892

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner
  • @nodejs/url

@nodejs-github-botnodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jul 26, 2025
@himself65
himself65 marked this pull request as ready for review July 26, 2025 09:47
@codecov

codecovBot commented Jul 26, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.36842% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.07%. Comparing base (04c5a18) to head (2bd843b).
⚠️ Report is 2889 commits behind head on main.

Files with missing linesPatch %Lines
src/node_file.cc0.00%0 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #59220 +/- ##
==========================================
+ Coverage 90.04% 90.07% +0.02% 
==========================================
Files 648 648 Lines 191200 191234 +34 Branches 37472 37482 +10 ==========================================
+ Hits 172160 172247 +87 + Misses 11665 11606 -59 - Partials 7375 7381 +6 
Files with missing linesCoverage Δ
lib/fs.js98.18% <100.00%> (+<0.01%)⬆️
lib/internal/fs/utils.js99.39% <100.00%> (+0.02%)⬆️
src/node_file.cc75.85% <0.00%> (-0.04%)⬇️

... and 29 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.

@himself65

Copy link
Copy Markdown
MemberAuthor

this might be not a good solution. let me find another way

@aduh95

Copy link
Copy Markdown
Contributor

That's definitely a wrong solution, we need Buffer to support non-unicode paths

@himself65

Copy link
Copy Markdown
MemberAuthor

yeah, I see path = getValidatedPath(path); is a misleading code, the rest of the logic is pretending path is string but it's actually not. If I change getValidatedPath to support buffer + options.encoding I would guess it will have lot of performance regression

@himself65

Copy link
Copy Markdown
MemberAuthor

I think I find a good way

@himself65himself65 changed the title fs: convert to string if input path is bufferfs: fix buffer input with recursive mode on readdirJul 27, 2025
@himself65
himself65force-pushed the himself65/2025/07/26/buffer branch from 93e0a32 to 2bd843bCompareJuly 28, 2025 17:52
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib / srcIssues and PRs related to general changes in the lib or src directory.needs-ciPRs that need a full CI run.stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

all versions of readdir don't work in recursive mode when used with a buffer argument

3 participants

@himself65@nodejs-github-bot@aduh95