Skip to content

vfs: handle current-position sentinel in memory files#64163

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:vfs-read-sync-position
Open

vfs: handle current-position sentinel in memory files#64163
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:vfs-read-sync-position

Conversation

@trivikr

@trivikr trivikr commented Jun 27, 2026

Copy link
Copy Markdown
Member

Fixes: #64162

This updates VFS memory file handles to treat -1 as the current-position
sentinel for read and write operations.

fs.readSync() normalizes a null position to -1 before dispatching to VFS,
but MemoryFileHandle previously treated -1 as an explicit offset. That made
mounted in-memory files fail instead of reading from and advancing the current
file position.


Assisted-by: openai:gpt-5.5

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
@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 Jun 27, 2026
@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 27, 2026
@trivikr trivikr requested a review from mcollina June 30, 2026 21:09

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@trivikr trivikr added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 1, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 1, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. 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.

vfs: mounted fs.readSync(fd, ..., null) treats position as -1 and throws

3 participants