Skip to content

etc-merge: Fix fs-verity only diff on files - #2650

Merged
Johan-Liebert1 merged 3 commits into
bootc-dev:mainfrom
Johan-Liebert1:etc-merge-stuff
Nov 16, 2026
Merged

Johan-Liebert1 merged 3 commits into
bootc-dev:mainfrom
Johan-Liebert1:etc-merge-stuff

Conversation

@Johan-Liebert1

Copy link
Copy Markdown
Member

etc-merge: Fix fs-verity only diff on files

We were never checking the fs-verity difference between files in the
current and pristine etc, and any modified files were always skipped
from the diff and merge.

We never hit this issue because our /etc mount does not have fs-verity
enabled on any files which would end up the code taking the content hash
path every time


cli: Add --json flag to DirDiff command

Also add test for fs-verity enabled diff

We were never checking the fs-verity difference between files in the
current and pristine etc, and any modified files were always skipped
from the diff and merge.

We never hit this issue because our /etc mount does not have fs-verity
enabled on any files which would end up the code taking the content hash
path every time

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 06:48
@bootc-bot
bootc-bot Bot requested a review from gursewak1997 November 12, 2026 06:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The digest comparison can misclassify unchanged files and overwrite updated image defaults, while an incorrect bootc path prevents the regression test from reaching its assertions.

2 open issues
What changed in this PR

Updates bootc’s /etc merge logic to detect content changes in fs-verity-enabled files, helping preserve local configuration during composefs upgrades.

Changes:

  • Compares verity digests and falls back to content hashes when only one file has verity enabled.
  • Adds JSON output to the internal directory-diff command and regression cases for verity-enabled files.
  • Installs fs-verity tooling in test images.
File Description
tmt/​tests/​booted/​test-etc-merge-conflict.nu Adds verity-enabled and mixed-verity diff regression cases.
Dockerfile Installs fsverity-utils and enables EPEL where needed.
crates/​lib/​src/​cli.rs Adds dir-diff --json and passes directory handles for hashing.
crates/​lib/​src/​bootc_composefs/​finalize.rs Supplies directory handles during upgrade and finalization diffing.
crates/​etc-merge/​src/​lib.rs Adds verity-aware comparison, content-hash fallback, and serializable diff types.
crates/​etc-merge/​Cargo.toml Adds the Serde dependency.
Cargo.lock Records Serde as an etc-merge dependency.

Review effort: Balanced

Comment thread crates/etc-merge/src/lib.rs Resolved
Also add test for fs-verity enabled diff

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
let mut pristine_hash = old_meta.content_hash.clone();
let mut current_hash = current_meta.content_hash.clone();

let compute_hash = |mut file: cap_std::fs::File| -> anyhow::Result<String> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nesting here is getting really deep, surely we could factor some of this out into a helper function


pristine_hash != current_hash
}
(Some(old_verity), Some(current_verity)) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we moved this case up, then the match statement for the case above could just be a fallthrough of _

@Johan-Liebert1

Copy link
Copy Markdown
Member Author

Will address the comments in a followup

@Johan-Liebert1
Johan-Liebert1 merged commit 84477c4 into bootc-dev:main Nov 16, 2026
102 of 105 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.

3 participants