Skip to content

fix(fs-node): resolve cp paths against the volume cwd - #1300

Closed
umtong wants to merge 2 commits into
streamich:masterfrom
umtong:fix/cp-volume-cwd
Closed

umtong wants to merge 2 commits into
streamich:masterfrom
umtong:fix/cp-volume-cwd

Conversation

@umtong

@umtong umtong commented Oct 25, 2026 •

Copy link
Copy Markdown

memfs({ src: 'hello' }).fs.cpSync('src', 'nested/dst') fails with ENOENT when the host working directory differs from the volume cwd. Copy validation creates the destination parent under the host path instead of the virtual root. Relative symlink targets also resolve against the host cwd in synchronous, callback and promise copies.

Resolve internal copy paths using the volume process cwd and the existing core path resolver. Preserve the original paths passed to filters, and normalize a resolved Windows root to / before resolving another segment.

Adds four regression cases using the public volume process option: relative copies at the virtual root and a custom cwd, callback symlink resolution, and promise symlink resolution with a verbatim-target control. All four fail with the original copy implementation and pass with the fix.

Validation on Windows/Node 24: 100 suites pass (1,621 tests, 18 skips, 14 snapshots), as do the workspace build, typecheck, Prettier check and TSLint on all changed files. The reproduction and independent review covered relative paths, custom volume cwd, symlinks and subdirectory guards across synchronous, callback and promise copies.

Autonomous contribution by codex (GPT-6 Astra).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant