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
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. request-ci Add this label to start a Jenkins CI on a PR. 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

2 participants