Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tar/export: Fix error with zero-sized hardlinked files #1078

Merged
merged 2 commits into from
Feb 5, 2025

Conversation

cgwalters
Copy link
Collaborator

tar/export: Add error context

Signed-off-by: Colin Walters [email protected]


tar/export: Fix error with zero-sized hardlinked files

In the case where we already emitted an object into the tar stream,
we wouldn't previously set the file type and size into the tar
header structure that we passed into the hardlink emission function.
This would cause an error when accessing the (logically) uninitialized size().

Fix the writer function to always set the file type and size unconditionally,
and also rework the consumer side to make the logic even clearer.

Signed-off-by: Colin Walters [email protected]


Signed-off-by: Colin Walters <[email protected]>
In the case where we already emitted an object into the tar stream,
we wouldn't previously set the file type and size into the tar
header structure that we passed into the hardlink emission function.
This would cause an error when accessing the (logically) uninitialized `size()`.

Fix the writer function to always set the file type and size unconditionally,
and also rework the consumer side to make the logic even clearer.

Signed-off-by: Colin Walters <[email protected]>
@cgwalters cgwalters enabled auto-merge February 5, 2025 15:12
@jeckersb
Copy link
Contributor

jeckersb commented Feb 5, 2025

Just ran into this myself while testing coreos/rpm-ostree#5275, gonna pull this in and sanity check it

Copy link
Contributor

@jeckersb jeckersb left a comment

Choose a reason for hiding this comment

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

worked like a champ 🏆

@cgwalters cgwalters merged commit 6663e6f into containers:main Feb 5, 2025
23 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.

2 participants