-
Notifications
You must be signed in to change notification settings - Fork 93
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
live: clean up CPIO handling; support extracting from arbitrarily concatenated archives #708
Conversation
We were letting xz2 finalize compression in Drop and not checking the return value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool stuff, LGTM overall! A bit unfortunate about the xz2 copying. Would be good to file something upstream and link it from the commit message and file header at least.
Last commit message should also expand on the why.
Have the extraction function return None if the member is not found, rather than erroring out.
If the buffer passed to read() is zero-length, a return value of Ok(0) does not indicate EOF. Don't do a trailing-garbage check in this case. I'm not aware of this bug occurring in the wild, and current code paths shouldn't exercise it.
It turns out Dropped the last commit for now. It's better suited to the followup PR where it'll be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Fix mishandling of two cases: - Read can return Ok(0) when not at EOF if the buffer argument is zero-length. - It's legal to call read() again after EOF, in which case we were trying to unwrap the thread handle again and panicking. Instead, return any thread error when we first reach EOF, and Ok(0) afterward.
We're about to switch to an xz implementation that doesn't handle trailing garbage detection itself.
xz2::bufread::XzDecoder errors on trailing garbage in the input stream, but we need to support trailing data to decode arbitrary initrds. xz2::write::XzDecoder does not error in this case, so implement the API of bufread::XzDecoder in terms of write::XzDecoder.
This allows `pxe ignition unwrap` to extract Ignition configs from initrds that have been concatenated to the OS initrd artifact. It will also be useful for other things later.
The kernel uses the last copy of a file in the archive, not the first, so we should do the same.
CI caught a failure 🎈 🎉 🎆 in osmet unpacking because we were calling |
pxe ignition unwrap
for now, but will also be useful infrastructure for switchingpxe customize
to producing a concatenated initrd. That's more consistent with theiso customize
UX, and also allows us to avoid possible version skew between the generated config and the OS version it's intended for.