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

decompress: don't panic on .tar.zip, .zip.zip, etc #432

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vrmiguel
Copy link
Member

@vrmiguel vrmiguel commented Jun 3, 2023

Hopefully closes #431

See #431 (comment) for context

@marcospb19
Copy link
Member

Previous behavior: we always decompress all formats in the chain for all supported files.

This PR breaks this, I'm clueless what are the implications of this.

We could suggest ouch decompress archive.zip.zip --format zip when we see more than one archive format in the format chain?

Would this be better or worse than the approach here? What do you guys think?

@@ -52,7 +52,7 @@ pub fn list_archive_contents(
Lzma => Box::new(xz2::read::XzDecoder::new(decoder)),
Snappy => Box::new(snap::read::FrameDecoder::new(decoder)),
Zstd => Box::new(zstd::stream::Decoder::new(decoder)?),
Tar | Zip => unreachable!(),
Tar | Zip => decoder,
Copy link
Member

Choose a reason for hiding this comment

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

I'd like a test to make sure we don't break this in the future.

Where it asserts that:

.zip.zip.zip
.zip.zip
.zip.tar
.tar.tar.tar
.tar.tar
.tar.zip

All generate a file with the correct path name.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried but I'm blocked since ouch does not yet allow compressing into something like .zip.zip 😢

We'd have to do that first before making this test

Copy link
Member

Choose a reason for hiding this comment

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

@vrmiguel it's possible

$ ouch compress README.md archive.zip
$ ouch compress archive.zip archive.zip.zip --format zip

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.

Duplicating file suffix causes panic: "entered unreachable code"
3 participants