Expose datagram truncation instead of losing recvmsg result flags
- Dominant language
- Rust
- Stars
- 53
- Forks
- 16
- Avg merge
- 4h 22m
- Merged PRs (30d)
- 46
Description
The Linux vectored receive provider constructs a local NativeMessage, calls recvmsg, and returns only the byte count. The kernel-written `message.flags` are discarded. `udp_recv_vectored` then returns an ordinary successful NetIoResult, which has no truncation field.
For a datagram larger than the combined receive buffers, Linux reports MSG_TRUNC in the output flags. Once that flag is discarded, a caller cannot distinguish a complete datagram that exactly filled the buffers from the prefix of a larger datagram whose tail was discarded. The public single-buffer UDP receive helpers also expose only the count/error outcome.
This is a request for an observable portable result, not a claim that a returned byte count by itself violates recvmsg behavior.
Code evidence:
- [std/sys/linux/vector_io.wave:39](https://github.com/wavefnd/Wave/blob/ea74c2dafc31da876e5561f2d176ba719f5a0458/std/sys/linux/vector_io.wave#L39)
- [std/net/udp.wave:234](https://github.com/wavefnd/Wave/blob/ea74c2dafc31da876e5561f2d176ba719f5a0458/std/net/udp.wave#L234)
- [std/net/error.wave:34](https://github.com/wavefnd/Wave/blob/ea74c2dafc31da876e5561f2d176ba719f5a0458/std/net/error.wave#L34)
Acceptance:
- [ ] Preserve native truncation information through the provider boundary and expose it via a reviewed result/API extension or an explicit truncation error.
- [ ] Keep the number of bytes actually stored distinct from the original datagram size when a backend can report both.
- [ ] Cover smaller-than-buffer, exactly-full, oversized and zero-length datagrams over loopback, with one and several receive slices.
- [ ] Define equivalent observable behavior for supported native Windows/BSD providers without making TCP EOF semantics depend on datagram flags.
- [ ] Preserve bounded caller-owned storage and do not retry a truncated datagram as if its discarded tail were another stream read.
Reference: [Linux recvmsg output flags](https://man7.org/linux/man-pages/man2/recvmsg.2.html). Related #515 replaces Linux vector libc wrappers, but does not cover lost result flags; #509 concerns zero-length TCP reads, and #508 concerns error-code classification.
Audit status: static source inspection against canonical master `ea74c2dafc31da876e5561f2d176ba719f5a0458` on 2026-09-10. No compiler build, test execution, implementation change or local reproduction was performed for this report. The examples describe the source-derived behavior to verify when implementing the fix.
Contributor guide
Research direction
Start with std/sys/linux/vector_io.wave:39, std/net/udp.wave:234, and std/net/error.wave:34 to trace recvmsg flags through the provider and public UDP helpers. Compare the supported Windows and BSD providers, then cover the listed loopback datagram cases with one and several receive slices; done means truncation is observable, stored bytes remain distinct from datagram size, and TCP EOF behavior is unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100