Re: [PATCH 02/20] scripts/make-erofs.sh: Do not read one byte at a time

Alyssa Ross
2025-09-08T08:23:24Z

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

Demi Marie Obenour <demiobenour@gmail.com> writes:

> POSIX requires that the shell read builtin not consume any bytes beyond
> the end-of-line character. For non-seekable files like pipes, this
> requirement can only be met by reading one byte at a time, which is very
> slow. Avoid this by reading the entire input into a temporary file and
> having sh read from the temporary file. Since regular files are
> seekable, sh can read many bytes and then seek back to the correct file
> position.

Slow enough to make a noticeable difference in the context of the whole
script?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]