Trivikram Kamat
b2a024b1ad
vfs: make lchown update symlink metadata
...
Route mounted lchown operations through VFS lchown handling and add
memory provider support that does not follow the final symlink.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64573
Fixes: https://github.com/nodejs/node/issues/64572
Reviewed-By: Aviv Keller <me@aviv.sh >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-07-28 05:46:07 +00:00
AkshatOP
4bec1915dc
vfs: make recursive readdir iterative
...
MemoryProvider recursive readdir walked the directory tree with a
recursive helper. Rewrite it to traverse iteratively with an explicit
stack so a deeply nested tree can no longer exhaust the call stack.
The set of directories on the active traversal path is still tracked, so
a circular symlink stops descending while its entry remains listed; the
output and observable behavior are unchanged.
Refs: https://github.com/nodejs/node/pull/64168
Signed-off-by: AkshatOP <hunterdevil0987@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/64149
Fixes: https://github.com/nodejs/node/issues/64148
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-07-21 06:37:41 +00:00
Trivikram Kamat
1d4e86ec7f
vfs: make lchmod update symlink mode
...
Use a non-following provider operation for lchmod so it updates the
symbolic link metadata instead of changing the target file mode.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64350
Fixes: https://github.com/nodejs/node/issues/64349
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-07-17 20:47:53 +00:00
Y1D7NG
a27fe2198a
vfs: fix VirtualReadStream race with async iteration
...
Fixes: https://github.com/nodejs/node/issues/64377
Signed-off-by: y1d7ng <y1d7ng@yeah.net >
PR-URL: https://github.com/nodejs/node/pull/64394
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-07-16 18:52:19 +00:00
Trivikram Kamat
d3be8ab515
vfs: follow symlinked dirs in recursive mkdir
...
Recursive mkdir currently checks an existing intermediate entry
directly, so a symlink to a directory is treated as a non-directory
and throws ENOTDIR.
Resolve symlinked intermediate components while walking the recursive
mkdir path, creating new directories in the resolved target while
preserving the caller-facing first-created return path.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64287
Fixes: https://github.com/nodejs/node/issues/64286
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-07-07 01:09:03 +00:00
Trivikram Kamat
7d941ec7e8
vfs: reject rename into descendant directory
...
MemoryProvider allowed renaming a directory into its own descendant,
which detached the subtree from the root. Reject this case with EINVAL
before mutating the tree.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64285
Fixes: https://github.com/nodejs/node/issues/64284
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-07-06 14:06:19 +00:00
Trivikram Kamat
387332fbf3
vfs: handle current-position sentinel in memory files
...
Treat -1 as the current file position in MemoryFileHandle read and
write operations. This matches the value passed by fs.readSync() after
normalizing a null position.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64163
Fixes: https://github.com/nodejs/node/issues/64162
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-07-04 07:58:04 +00:00
Trivikram Kamat
a6d3e9369f
vfs: support writeFileSync with virtual fds
...
Route fs.writeFileSync() and fs.appendFileSync() calls with VFS-owned
file descriptors through the virtual file handle instead of falling
back to the native fs binding. This preserves descriptor semantics for
both memory-backed VFS files and RealFSProvider handles.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64165
Fixes: https://github.com/nodejs/node/issues/64164
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day >
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-07-02 15:28:55 +00:00
Matteo Collina
ea60060617
vfs: avoid recursive readdir symlink cycles
...
Track the active MemoryProvider recursive readdir traversal path so
circular symlinks to directories stop recursing while still listing
the symlink entries.
Add sync, promise, and withFileTypes coverage.
Fixes: https://github.com/nodejs/node/issues/64148
Signed-off-by: Matteo Collina <hello@matteocollina.com >
PR-URL: https://github.com/nodejs/node/pull/64168
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day >
2026-06-30 10:08:40 +00:00
Trivikram Kamat
8cb83126b8
vfs: read RealFSProvider files from open fd
...
Read RealFileHandle contents through the open file descriptor instead
of reopening the original real path. This keeps already-open VFS file
descriptors usable after the backing file is renamed.
Use positioned reads so readFileSync() and readFile() preserve the
handle's current offset.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64104
Fixes: https://github.com/nodejs/node/issues/64103
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-06-27 06:07:44 +00:00
Antoine du Hamel
1778eeb6e4
lib: add lint rule to enforce use of kEmptyObject
...
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/63790
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-06-10 10:56:56 +00:00
Matteo Collina
569369f927
vfs: dispatch fs/promises to mounted VFS instances
...
Add mount/unmount lifecycle on `VirtualFileSystem`, a handler registry
that fs.js and fs/promises.js consult via `vfsState.handlers`, and a
router that maps absolute paths to the VFS that owns them. When a VFS
is mounted, the public `fs.*` and `fs/promises` APIs (including
streams, `fs.watch`, and `opendir`) dispatch to the provider for paths
under the mount point, and fall through to the real filesystem
otherwise. Includes per-method dispatch tests, error-path coverage,
multi-mount routing tests, and router unit tests.
Ref: https://github.com/nodejs/node/pull/63115
Signed-off-by: Matteo Collina <hello@matteocollina.com >
PR-URL: https://github.com/nodejs/node/pull/63537
Refs: https://github.com/nodejs/node/pull/63115
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
2026-05-29 17:57:34 +00:00
Trivikram Kamat
92f48f43fe
tools: enforce iterator result property order
...
Add a custom ESLint rule requiring iterator result objects to place
`done` before `value`, and update existing lib iterator result objects
to follow the rule.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63526
Reviewed-By: Mattias Buelens <mattias@buelens.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-05-26 17:19:42 +00:00
Matteo Collina
c9562ddb82
vfs: add minimal node:vfs subsystem
...
Adds the node:vfs builtin module with VirtualFileSystem and
provider classes. No integration with fs, modules, or SEA.
Assisted-by: Claude-Opus4.7
Signed-off-by: Matteo Collina <hello@matteocollina.com >
PR-URL: https://github.com/nodejs/node/pull/63115
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2026-05-23 18:43:31 +00:00