Severity: MEDIUM Status: Fixed
cmdLoadBuffer reads the file in a loop but treats any negative return from std.c.read as a hard failure:
// src/cmd/cmd.zig:550-575
while (true) {
const n = std.c.read(fd, &chunk, chunk.len);
if (n < 0) return .err; // EINTR (and other transient errors) abort here
if (n == 0) break;
// ... appendSlice into data ...
}
read() can return -1 with errno == EINTR when a signal (e.g. SIGCHLD from a child, or any pending signal) interrupts the syscall. szn uses raw syscalls, so there is no automatic restart.EINTR, load-buffer returns .err and the buffer is not loaded, even though a simple retry would have succeeded. The operation is non-idempotent from the user’s perspective (the paste/buffer is lost).save-buffer already handles EINTR per bug #391’s cluster; load-buffer was missed.)Distinguish EINTR from real errors and continue the loop on EINTR (or use errno and retry). Optionally loop on EAGAIN as well, consistent with the rest of the I/O surface.