fsck: Return typed findings from the checks - #2528
Merged
Merged
Conversation
fsck() takes an output stream, but passing checks were still printed with println!, so a caller capturing the output (or a test) saw only the failures. Also print runtime errors with their context chain, so e.g. "Computing verity state" isn't dropped. Generated-by: AI Signed-off-by: Colin Walters <walters@verbum.org>
The check opened the ambient /usr itself, so it could only run on a booted host. Taking the directory makes the check itself testable against a fixture. Prep for converting the checks to return findings. Generated-by: AI Signed-off-by: Colin Walters <walters@verbum.org>
The checks returned at most one free-form error string, so the fsverity check pre-formatted its own truncated list of objects, and nothing could tell the kinds of problems apart. The readonly report being added in bootc-dev#2497 settled on a two-level shape instead: fatal errors in the outer anyhow::Result, every problem found collected as a typed finding with a subject. Use the same shape here, so the two can share a finding type once that lands. The output stays bounded: the runner prints at most five findings per check and counts the rest, as the fsverity check did itself before. The messages become one "code: subject: detail" line per finding; the tmt tests only look at the exit status. Generated-by: AI Signed-off-by: Colin Walters <walters@verbum.org>
cgwalters
approved these changes
Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
bootc internals fsckchecks returned at most one free-form error string (FsckResult = anyhow::Result<Result<(), FsckError>>). This converts them to the two-level shape the readonly report in #2497 uses: fatal errors in the outeranyhow::Result, every problem found collected as a typed finding (code,subject,detail). The runner bounds the output to five findings per check, which the fsverity check used to do on its own.The types are named
CheckFinding/CheckFindingCodefor now so this doesn't collide with #2497's privateFinding/FindingCodein the same file; once that lands, the check codes can become one moreFindingCodegroup.Two prep commits: passing checks are now written to the given output instead of stdout, and the resolv.conf check takes a
Dirso it can be unit tested.Testing (16-core devspace): at b5ea223,
just validateandjust unit-testspassed (bootc-lib: 284 passed, including the new table-drivenfsck::tests), andjust test-tmt readonly(centos-bootc stream10, ostree) passed, with015-test-fsckprintingok: etc-resolvconfandok: fsverity.Follow-up to #2497.
The
Signed-off-by: Colin Walters <walters@verbum.org>on these commits was added on cgwalters's approval of the review draft: cgwalters-forge#35 (review)Generated-by: https://github.com/cgwalters/#llms