On 2026-11-18 07:30, Martin Mirchev wrote:
POSIX allows read() to
return fewer bytes than requested even when more data follows

Not for regular files. Unless a signal arrives, or the read buffer size exceeds SSIZE_MAX, or the resulting file offset would exceed the maximum off_t value (none of which is the case here), POSIX doesn't allow short reads of regular files that have more data following.

this
happens for instance on FUSE files opened with direct I/O

That behavior of FUSE breaks applications like dd, and there is no reasonable workaround there. But I'm not surprised about this, as FUSE fails to conform to POSIX in other ways, ways that break Git etc.

If the workaround for 'head' is easy then we might as well do it. But please let's not say that we're fixing a 'head' bug or because because POSIX allows short reads of regular files: it's because we're working around a failure of FUSE to conform to POSIX.



Reply via email to