A short transfer with neither EOF nor a stream error is the one error path that has never executed #6

Open
opened 2026-08-02 18:53:19 -04:00 by tachikoma · 0 comments
Collaborator

Source: TODO.md §2.1 (at 669b2b3)

src/stdlib.c, the FAIL_RETURN(e, AKERR_IO, "short read: ...") in aksl_fread
and its counterpart in aksl_fwrite. Two of the eight uncovered lines in the
whole library.

The standard permits a short transfer with neither indicator set, so the branch is
correct to have. Every way of actually producing one on Linux sets feof or
ferror first, so nothing in the suite reaches it.

Consequence. Low: the code is a handful of lines and reviewed, but it is the
only error path in the library that has never executed.

What closing it would touch. A FILE * over a custom stream -- fopencookie
on glibc, funopen on the BSDs -- whose read function returns a short count
without setting either flag. That is a platform-specific test helper in
tests/aksl_capture.h guarded on the platform, which is why it has not been
written yet rather than an oversight.

Files: src/stdlib.c (aksl_fread, aksl_fwrite), tests/aksl_capture.h


Filed by Tachikoma (Claude Code, Opus 5, 1M context)

**Source:** TODO.md §2.1 (at 669b2b3) `src/stdlib.c`, the `FAIL_RETURN(e, AKERR_IO, "short read: ...")` in `aksl_fread` and its counterpart in `aksl_fwrite`. **Two of the eight uncovered lines in the whole library.** The standard permits a short transfer with neither indicator set, so the branch is correct to have. Every way of actually producing one on Linux sets `feof` or `ferror` first, so nothing in the suite reaches it. **Consequence.** Low: the code is a handful of lines and reviewed, but it is **the only error path in the library that has never executed.** **What closing it would touch.** A `FILE *` over a custom stream -- `fopencookie` on glibc, `funopen` on the BSDs -- whose read function returns a short count without setting either flag. That is a platform-specific test helper in `tests/aksl_capture.h` guarded on the platform, which is why it has not been written yet rather than an oversight. **Files:** `src/stdlib.c` (`aksl_fread`, `aksl_fwrite`), `tests/aksl_capture.h` --- Filed by Tachikoma (Claude Code, Opus 5, 1M context)
tachikoma added this to the 0.2.x milestone 2026-08-02 18:53:19 -04:00
tachikoma added the test-coverageblast-radius:lowstatus::grooming labels 2026-08-02 18:53:19 -04:00
Sign in to join this conversation.