Skip to content

scan: sort xattrs for reproducibility#62

Merged
jlebon merged 3 commits intomainfrom
trusted-filter
Feb 19, 2026
Merged

scan: sort xattrs for reproducibility#62
jlebon merged 3 commits intomainfrom
trusted-filter

Conversation

@jlebon
Copy link
Copy Markdown
Member

@jlebon jlebon commented Feb 19, 2026

Yet another source of reproducibility issues. If a file has multiple
xattrs, the order in which we read them in may change, but serializing
them to the tar layer needs to be deterministic.

Sort them at scan time.

Extend the buildtime e2e test to try to cover this by adding more
xattrs (including ACLs which we didn't have any coverage for before).
Though it's not easy to really test this without injecting our own
llistxattr(2).

Assisted-by: Claude Opus 4.6

When building with older buildah, we have to use the `-v $PWD:/run/src`
trick, but then we need to clean up the OCI archive. I don't like using
the `RUN` trick to remove the OCI archive for various reasons. But it's
trivial anyway to just clean it up ourselves.
@jlebon jlebon enabled auto-merge (rebase) February 19, 2026 20:45
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a reproducibility issue by sorting extended attributes during the scan phase. The changes are logical and well-implemented. The introduction of trusted. xattr filtering is a sensible addition. The end-to-end tests have been significantly improved to validate reproducibility by building the same image twice and comparing their IDs, which is an excellent approach. The test setup is also more robust by using a pre-built rootfs image. Overall, this is a high-quality contribution.

Comment thread src/scan.rs Outdated
Yet another source of reproducibility issues. If a file has multiple
xattrs, the order in which we read them in may change, but serializing
them to the tar layer needs to be deterministic.

Sort them at scan time.

Extend the buildtime e2e test to try to cover this by adding more
xattrs (including ACLs which we didn't have any coverage for before).
Though it's not easy to really test this without injecting our own
llistxattr(2).

Assisted-by: Claude Opus 4.6
Noticed this while working on the previous commit. We were picking up
legacy XFS SGI_ACL_* xattr aliases for ACLs, which is just yucky. AFAICT
there's no use case for preserving some trusted xattrs, so just skip
them all for now until we find out otherwise.

Assisted-by: Claude Opus 4.6
@jlebon jlebon merged commit 8495965 into main Feb 19, 2026
6 checks passed
@jlebon jlebon deleted the trusted-filter branch February 19, 2026 20:56
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.

1 participant