Files
erofs-freebsd-out-tree/tests/TC019-48bit-root-nid.md
T
2026-08-18 09:20:44 +02:00

1.5 KiB

Test Case: Nonzero 48-bit Root NID

Test ID: TC019-48bit-root-nid

Objective

Verify the 48BIT && rootnid_8b != 0 selector uses the complete 64-bit root field and interprets the two-byte union as blocks_hi.

Fixture

Use images/root8-48bit.erofs. The structured transformer requires incompat bit 0x80, nonzero image-bounded rootnid_8b, blocks_hi=0, valid CRC32C, and unchanged provider-sized blocks_lo. Production fsck.erofs 1.8.6 does not recognize this feature; FreeBSD mount/read is mandatory.

Procedure

Host field check:

python3 tests/erofs_fixture.py inspect /work/build/repo22-g1/images/root8-48bit.erofs --path=/root.txt
od -An -tu2 -j 1038 -N 2 /work/build/repo22-g1/images/root8-48bit.erofs
od -An -tx4 -j 1104 -N 4 /work/build/repo22-g1/images/root8-48bit.erofs
od -An -tu8 -j 1136 -N 8 /work/build/repo22-g1/images/root8-48bit.erofs

Mount the same hashed image in FreeBSD, then run:

stat -f 'root_ino=%i type=%HT' "$mnt"
cmp /tmp/repo22-g1/source/compact/root.txt "$mnt/root.txt"
sha256 /tmp/repo22-g1/source/compact/root.txt "$mnt/root.txt"
./statfs_probe "$mnt"

Expected Results

  • feature_incompat & 0x80 is set, rootnid_8b is nonzero, and observed root inode equals that complete field.
  • Root content matches the source and statfs uses blocks_lo plus zero blocks_hi; mount and cleanup succeed.
  • TC150's zero-rootnid_8b fallback is a separate selector and is not accepted as evidence for this TC.