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

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@mcollina mcollina added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 2, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jul 2, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/64163
βœ”  Done loading data for nodejs/node/pull/64163
----------------------------------- PR info ------------------------------------
Title      vfs: handle current-position sentinel in memory files (#64163)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     trivikr:vfs-read-sync-position -> nodejs:main
Labels     author ready, needs-ci, vfs
Commits    1
 - vfs: handle current-position sentinel in memory files
Committers 1
 - Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
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>
------------------------------ Generated metadata ------------------------------
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>
--------------------------------------------------------------------------------
   β„Ή  This PR was created on Sat, 27 Jun 2026 06:27:18 GMT
   βœ”  Approvals: 1
   βœ”  - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/64163#pullrequestreview-4606354361
   ✘  This PR needs to wait 46 more hours to land (or 0 minutes if there is one more approval)
   βœ”  Last GitHub CI successful
   β„Ή  Last Full PR CI on 2026-07-02T04:00:37Z: https://ci.nodejs.org/job/node-test-pull-request/74500/
- Querying data for job/node-test-pull-request/74500/
βœ”  Build data downloaded
   βœ”  Last Jenkins CI successful
--------------------------------------------------------------------------------
   βœ”  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/28576287827

@trivikr trivikr removed the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Jul 2, 2026
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