read(2) and thus bsdiff is limited to 2^31 bytes

Dirk Engling erdgeist at erdgeist.org
Mon May 23 12:37:03 UTC 2016


On 23.05.16 14:21, Joerg Sonnenberger wrote:

> Atomic meaning in this context that the read can be observed either
> completely or not at all. This still doesn't mean that read must
> execute the full size. Other cases for short read/writes are socket,
> pipes etc.

On linux I found read() returning a short read, however I wonder if any
user land application developer ever expects a read from local file to
yield a short read and continue reading. Maybe I should scan base system
sources for all occurrences of read.

Best case scenario as found in bsdiff is

  if (read(fd,old,oldsize)!=oldsize)

and I wonder if an API user SHOULD be expecting the short read behaviour
at all, just because the nbytes crosses a certain arbitrary threshold.

  erdgeist


More information about the freebsd-hackers mailing list