]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
m_offset: make self-test reliable with non-GNU yes(1)
authorMatthias Andree <matthias.andree@gmx.de>
Thu, 26 Jun 2025 20:28:40 +0000 (22:28 +0200)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 1 Jul 2025 14:32:24 +0000 (10:32 -0400)
commit880b431f412017f521c2d328b7e234db4568ba35
tree42144966ba900f9724cfb536c70e0ec8337fa8e9
parent9faee163ce799c66a31f6994a980fdc93c72dc10
m_offset: make self-test reliable with non-GNU yes(1)

m_offset has been failing sporadically on FreeBSD, and always because
crc_exp(ected) was different from all other CRC values (which were
mutually equal, first1, first2, last).

The test scrsipt uses yes(1) to write into dd(1),
but FreeBSD's "yes a" use sizes of 8192 - length-of-pattern, meaning
8190 with "a\n" (meaning a + LF).
GNU yes from coreutils 9.1 instead dispatches 1024-sized writes.

The peculiar thing is that dd bs=1k count=512 will dispatch 512 read
attempts of 1 k each, but due to yes and dd running concurrently, dd
will sometimes see a short read block, resulting in an overall shorter
output file fed into crcsum, leading to a mismatched crc_exp value.

Fix: Add iflag=fullblock to ensure the proper output size will be fed
into crcsum, even if that means doing more than 512 reads internally.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Link: https://lore.kernel.org/r/20250626202919.321842-1-matthias.andree@gmx.de
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
tests/m_offset/script