You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
self._finish().expect("Decompressor::finish MUST be called")
unexpected end of file
If all that happened here was an unexpected EOF we should definitely not panic on that. I think we probably need to just drop this panic because on error paths exactly like this it may be hit. Ultimately the calling code should be verifying checksums and the like for integrity.
If I had to guess, there's probably an error case somewhere that we missed that should be updated to clear out the decompressor when we get EOF like that. I would be extremely wary to remove that panic, the comment above there sums up why.
Which is easily reproduced by just feeding it an empty src:
diff --git i/ostree-ext/src/container/unencapsulate.rs w/ostree-ext/src/container/unencapsulate.rs
index 81eb90c7..21f7c23d 100644
--- i/ostree-ext/src/container/unencapsulate.rs
+++ w/ostree-ext/src/container/unencapsulate.rs
@@ -362,4 +362,11 @@ mod tests {
let d = Decompressor::new(&oci_image::MediaType::ImageLayer, empty).unwrap();
drop(d)
}
+
+ #[test]
+ fn test_drop_decompressor_with_incomplete_gzip_data() {
+ let empty = std::io::empty();
+ let d = Decompressor::new(&oci_image::MediaType::ImageLayerGzip, empty).unwrap();
+ drop(d)
+ }
}
=>
---- container::unencapsulate::tests::test_drop_decompressor_with_incomplete_gzip_data stdout ----
thread 'container::unencapsulate::tests::test_drop_decompressor_with_incomplete_gzip_data' panicked at ostree-ext/src/container/unencapsulate.rs:217:24:
Decompressor::finish MUST be called: unexpected end of file
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
So really the problem is that when we finish the decompressor, we want to empty out the underlying pipe and ignore anything happening with the actual decompression. But the way things are currently structured, that's not accessible. We'd need some way to into_inner() on the GzDecoder or similar.
Activity
cgwalters commentedon Jul 15, 2025
So we got here
bootc/ostree-ext/src/container/unencapsulate.rs
Line 217 in c8e7a68
If all that happened here was an unexpected EOF we should definitely not panic on that. I think we probably need to just drop this panic because on error paths exactly like this it may be hit. Ultimately the calling code should be verifying checksums and the like for integrity.
And eventually we should switch to podman-container-tools/skopeo#2601
[-]error while running bootc switch[/-][+]panic on unexpected EOF during pull[/+]jeckersb commentedon Jul 15, 2025
If I had to guess, there's probably an error case somewhere that we missed that should be updated to clear out the decompressor when we get EOF like that. I would be extremely wary to remove that panic, the comment above there sums up why.
jeckersb commentedon Jul 15, 2025
Actually looking at it again, the
unexpected end of fileis coming frombootc/ostree-ext/src/container/unencapsulate.rs
Line 267 in c8e7a68
So I'm guessing something is wrong with the state of
self.innerjust based on the assumption that astd::io::sink()can't give unexpected EOF.jeckersb commentedon Jul 16, 2025
I think this is probably coming from the gzip stream
https://github.com/rust-lang/flate2-rs/blob/7145603d57b7795c51d8674824163d6d685c9733/src/gz/mod.rs#L243
(give or take)
Which is easily reproduced by just feeding it an empty src:
=>
So really the problem is that when we finish the decompressor, we want to empty out the underlying pipe and ignore anything happening with the actual decompression. But the way things are currently structured, that's not accessible. We'd need some way to
into_inner()on theGzDecoderor similar.unencapsulate: use "inner" stream when finishing Decompressor
unencapsulate: use "inner" stream when finishing Decompressor
ostree-ext: Refactor decompression