You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`PathResolution.resolve()` returned the input fd unchanged for "." paths, causing fd table entries to alias the same host fd. Closing one invalidated the other, which errored with EBADF.
Multiple related fixes are included to clean up the general situation with FD handling in WASIp1 implementation:
- Fix fd aliasing in `PathResolution.resolve()`: When the path resolves without opening a new fd (e.g. "."), dup via `openat(fd, ".")` so callers always get an independently closeable fd.
- Fix `SplitPath` premature deinit: Use `borrowing func withFields` to keep `SplitPath: ~Copyable` alive during operations that use its parent fd.
- Add `WASIBridgeToHost.runAndClose`: Scoped API that ensures `close()` is called, replacing the previous `deinit`-based cleanup.
- Add `isBorrowed` to `WASIEntry`: Stdio entries are marked as borrowed so `closeAll()` never closes process stdin/stdout/stderr (previously broken when `fd_renumber` moved stdio to different WASI fd positions).
- Fix `directoryEntry(fd:)` error codes: Return `EBADF` for missing fds, `ENOTDIR` for non-directory fds (was `ENOTDIR` for both).
I ran tests locally 10 times in a row and on CI 5 times in a row on this PR, no failures, I think this is sufficient to say that flakiness is resolved.
Resolves#334.
0 commit comments