Pádraig Brady <[email protected]> writes:

> On 18/11/2026 21:37, Paul Eggert wrote:
>> 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.
>
> Right agreed.
>
> The workaround is to use full_read() so simple enough.
> I'll ensure to say these are "edge cases" in NEWS,
> and might not even mention this in NEWS at all.
>
> Marking this bug as done.

Doesn't full_read also retry on EINTR because it uses safe_read?

Not sure if the behavior change really matters, but figured it was worth
mentioning.

Collin



Reply via email to