lib/container_export: Always skip /tmp and /var/tmp during export - #2395
Closed
cgwalters wants to merge 1 commit into
Closed
lib/container_export: Always skip /tmp and /var/tmp during export#2395cgwalters wants to merge 1 commit into
cgwalters wants to merge 1 commit into
Conversation
CentOS 10 UKI CI jobs fail "bootc container export --format=tar" with "No label found in policy ... for /var/tmp/rhc". rhc's post-install scriptlet drops runtime state under /var/tmp during image build (same rhc-1:0.3.12-1.el10 build in both passing and failing CI runs, so this isn't a version regression in rhc itself), and the SELinux targeted policy simply has no file-context entry for it. This only reproduces reliably on the composefs+uki matrix legs, likely because that build path takes long enough for the scriptlet's async write to land before the image layer is committed - the file can be present or absent on other legs depending on timing. Rather than trying to tolerate arbitrary unlabeled paths anywhere in the tree (which risks silently exporting genuinely mislabeled files), extend the existing SKIP_PATHS list to always exclude /tmp and /var/tmp. These are meant to hold only ephemeral, runtime-created content - ostree-ext::commit's FORCE_CLEAN_PATHS already treats the same two paths (plus /run and /var/cache) this way for regular ostree commits, so tar export dropping them is consistent with how bootc already treats the real /var as not being part of the shippable content. Add a unit test exercising export_filesystem_walk() directly (with SELinux labeling disabled) against a synthetic root, verifying /tmp and /var/tmp content is dropped while everything else is kept. Assisted-by: AI Signed-off-by: Colin Walters <walters@verbum.org>
Collaborator
Author
|
Folded into #2394 instead, since our CI is currently blocked by both issues and it's simpler to land the fixes together. |
Collaborator
Author
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.
CentOS 10 UKI CI jobs fail
bootc container export --format=tarwith:rhc's post-install scriptlet drops runtime state under/var/tmpduringimage build, and the SELinux targeted policy has no file-context entry for
it. This reproduces reliably on the composefs+uki matrix legs, likely
because that build path takes long enough for the scriptlet's async write
to land before the image layer is committed (the file can be present or
absent on other legs depending on timing). Same
rhcpackage version wasobserved in both passing and failing CI runs, so this isn't a version
regression in
rhcitself.Rather than tolerating arbitrary unlabeled paths anywhere in the tree
(which risks silently exporting genuinely mislabeled files), this extends
the existing
SKIP_PATHSlist to always exclude/tmpand/var/tmp.These are meant to hold only ephemeral, runtime-created content -
ostree-ext::commit'sFORCE_CLEAN_PATHSalready treats the same twopaths (plus
/runand/var/cache) this way for regular ostree commits,so dropping them from tar export is consistent with existing behavior.
Adds a unit test exercising
export_filesystem_walk()directly (withSELinux labeling disabled) against a synthetic root, verifying
/tmpand/var/tmpcontent is dropped while everything else is kept.Assisted-by: AI
I am knowledgeable in this problem domain and reviewed it carefully.