Commit 3af9426
fix(fspy): observe libuv's syscall(SYS_close) closes on Linux
On glibc Linux, libuv (and therefore Node) closes every descriptor via
`syscall(SYS_close, fd)` rather than the `close` libc symbol — confirmed by
tracing: a `fs.writeFileSync` triggers zero `close()`/`__close_nocancel()`
calls and routes every close through the `syscall` wrapper. The `close`
symbol interposition therefore never observed Node's closes, so the `Closing`
callback never fired and worldline captured no writes (the Linux analog of
the macOS `close$NOCANCEL` gap; musl is unaffected because its seccomp
backend catches the close syscall directly).
The preload already interposes the libc `syscall` wrapper (for SYS_statx) and
forwards Node's SYS_close through it — it just didn't act on it. Fire the
close callback for SYS_close there, mirroring the existing handling. The
`close_callback_fires_for_node_write` regression test now passes on Linux too.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 4ca70cf commit 3af9426
1 file changed
Lines changed: 14 additions & 2 deletions
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
26 | 38 | | |
27 | 39 | | |
28 | 40 | | |
| |||
0 commit comments