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.

`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.30%. Comparing base (dc7838c) to head (819ceed).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #65062   +/-   ##
=======================================
  Coverage   90.30%   90.30%           
=======================================
  Files         759      759           
  Lines      247629   247644   +15     
  Branches    46688    46701   +13     
=======================================
+ Hits       223618   223636   +18     
- Misses      15469    15473    +4     
+ Partials     8542     8535    -7     
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 30 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.

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