Skip to content

vfs: fix path returned by recursive mkdir - #65062

Open
watilde wants to merge 1 commit into
nodejs:mainfrom
watilde:vfs-mkdir-recursive-return-path
Open

vfs: fix path returned by recursive mkdir#65062
watilde wants to merge 1 commit into
nodejs:mainfrom
watilde:vfs-mkdir-recursive-return-path

Conversation

@watilde

@watilde watilde commented Aug 5, 2026

Copy link
Copy Markdown
Member

mkdir() with recursive: true returns the first directory that was created. VFS passed the provider's return value straight through, so the path came back in the wrong namespace: RealFSProvider returned an absolute path inside its root, leaking that root to the caller, and a mounted VFS returned a VFS-internal path without the mount point.

Map the created path back through the provider and mount translations so the returned value is a path the caller can hand to fs again. This covers the sync, callback, and promises forms.

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. vfs Issues and PRs related to the virtual filesystem subsystem. labels Aug 5, 2026
@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.33%. Comparing base (dc7838c) to head (6f3bdfa).
⚠️ Report is 84 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65062      +/-   ##
==========================================
+ Coverage   90.30%   90.33%   +0.02%     
==========================================
  Files         759      760       +1     
  Lines      247629   248537     +908     
  Branches    46688    46903     +215     
==========================================
+ Hits       223618   224507     +889     
+ Misses      15469    15458      -11     
- Partials     8542     8572      +30     
Files with missing lines Coverage Δ
lib/internal/vfs/file_system.js 99.37% <100.00%> (+<0.01%) ⬆️
lib/internal/vfs/providers/real.js 95.32% <100.00%> (+0.23%) ⬆️

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

`mkdir()` with `recursive: true` returns the first directory that was
created. VFS passed the provider's return value straight through, so the
path came back in the wrong namespace: `RealFSProvider` returned an
absolute path inside its root, leaking that root to the caller, and a
mounted VFS returned a VFS-internal path without the mount point.

Map the created path back through the provider and mount translations so
the returned value is a path the caller can hand to `fs` again. This
covers the sync, callback, and promises forms.

Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
@watilde
watilde force-pushed the vfs-mkdir-recursive-return-path branch from 819ceed to 6f3bdfa Compare August 10, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. vfs Issues and PRs related to the virtual filesystem subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants