Skip to content

check_files: fix du based disksize tests on FreeBSD - #497

Merged
sni merged 2 commits into
mainfrom
check-files-tests-freebsd-du-fix
Nov 10, 2026
Merged

sni merged 2 commits into
mainfrom
check-files-tests-freebsd-du-fix

Conversation

@inqrphl

@inqrphl inqrphl commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

AI GENERATED

FreeBSD's du prints block counts in units of $BLOCKSIZE, while -B1 only rounds the internal accounting block size up to 512 bytes. Since /etc/login.conf sets BLOCKSIZE=K (inherited by ssh sessions), du -B1 printed 1 KiB blocks and the tests compared that against 512-byte blocks, failing by a factor of two.

The previous ZFS based VM image masked this: freshly written files reported 0 or 1 blocks, so ceil(blocks / 2) == blocks and the wrong conversion happened to match. The UFS image shipped with vmactions/freebsd-vm v1.6.0 reports real block counts and exposed the unit mismatch.

Pin BLOCKSIZE=512 for the du child so BSD du reports 512-byte blocks again. GNU du's -B1 already means bytes, so Linux is unaffected. No production code changes; disksize stays st_blocks * 512.

Ahmet Oeztuerk and others added 2 commits November 10, 2026 11:39
FreeBSD's du prints block counts in units of $BLOCKSIZE, while -B1 only
rounds the internal accounting block size up to 512 bytes. Since
/etc/login.conf sets BLOCKSIZE=K (inherited by ssh sessions), du -B1
printed 1 KiB blocks and the tests compared that against 512-byte
blocks, failing by a factor of two.

The previous ZFS based VM image masked this: freshly written files
reported 0 or 1 blocks, so ceil(blocks / 2) == blocks and the wrong
conversion happened to match. The UFS image shipped with
vmactions/freebsd-vm v1.6.0 reports real block counts and exposed the
unit mismatch.

Pin BLOCKSIZE=512 for the du child so BSD du reports 512-byte blocks
again. GNU du's -B1 already means bytes, so Linux is unaffected. No
production code changes; disksize stays st_blocks * 512.
@sni
sni merged commit 8b3a11d into main Nov 10, 2026
151 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants