Skip to content

feat(fs): long-tail ops — fsync/fdatasync, f*/l* metadata, readv/writev, statfs, glob (#976, recovery to main)#1007

Merged
nickna merged 1 commit into
mainfrom
wrk/issue-976-fs-longtail
Jun 29, 2026
Merged

feat(fs): long-tail ops — fsync/fdatasync, f*/l* metadata, readv/writev, statfs, glob (#976, recovery to main)#1007
nickna merged 1 commit into
mainfrom
wrk/issue-976-fs-longtail

Conversation

@nickna

@nickna nickna commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Recovery PR. #976 was approved/merged in #1006 but landed on the wrk/issue-972-filehandle branch instead of main (GitHub had not yet retargeted the stacked PR). #972 is now on main (via #1005), so this PR carries only the #976 long-tail diff.

Completes the fs long tail (fsync/fdatasync, fchmod/fchown/futimes, lchmod/lutimes, readv/writev, statfs+bigint, glob/globSync/promises.glob, exists) across sync/callback/promise in both modes. 3 new dual-mode primitives (fsyncSync/fdPath/statfsRaw), standalone preserved. Full suite 14472/0.

…ev, statfs, glob (#976)

Completes the fs long tail across sync/callback/promise in both modes (epic #968):

- Durability: fsync/fsyncSync, fdatasync/fdatasyncSync.
- fd-variant metadata: fchmod/fchown/futimes (routed through a new fdPath
  primitive to the path ops) + Sync forms.
- symlink metadata: lchmod (BSD/macOS-only -> ENOSYS elsewhere), lutimes.
- vectored I/O: readv/writev + Sync forms (loops over read/writeSync).
- statfs/statfsSync/promises.statfs (+ {bigint}), from DriveInfo.
- a minimal glob/globSync/promises.glob: `*`/`?`/`**` matcher over a recursive
  readdir walk; the promise form is an async iterator (Node 22+).
- exists (deprecated, non-err-first callback).

Approach B: only the genuinely native ops need primitives — fsyncSync, fdPath,
and statfsRaw — added in interp (FsModuleInterpreter) and as BCL-only emitted IL
(RuntimeEmitter.FsLongTail.cs) so compiled output stays standalone. Everything
else is one TS implementation in fs.ts/fs/promises.ts shared by both modes.
FileHandle.sync/datasync now do a real fd flush.

Deferred (issue-optional): realpathSync.native (function-property expando is
unsafe in compiled mode) and openAsBlob (needs Blob).

Gotcha: __globWalk's `catch { return }` tripped the compiled InvalidProgramException
(the #973 return-in-catch pattern); restructured to an assignment-only catch.

Verified byte-identical interp==compiled (scratch smoke), standalone preserved,
5 dual-mode tests per family (10 cases). Full suite 14472/0; TS conformance unchanged.
@nickna nickna merged commit 60f0fe9 into main Jun 29, 2026
2 checks passed
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