.zip.zip file ending results in unreachable code panic #10

Open
opened 2025-04-09 14:58:09 +00:00 by tcsenpai · 0 comments
Owner

Originally created by @happenslol on 3/26/2025

Version

0.5.1

Description

Reproducible with the following commands:

# any file will do here
echo "hello world" >> test

ouch compress test test.zip
mv test.zip test.zip.zip
ouch decompress test.zip.zip

Current Behavior

Full backtrace:

thread 'main' panicked at src/commands/decompress.rs:89:43:
internal error: entered unreachable code
stack backtrace:
   0:     0x564322b1d0f9 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h7964c48fa1e13ebd
   1:     0x564322a2d343 - core::fmt::write::h26d370e762806908
   2:     0x564322b3373e - std::io::Write::write_fmt::h7172e38dd4e6c5be
   3:     0x564322b1cf53 - std::sys::backtrace::BacktraceLock::print::hf0868af390127a97
   4:     0x564322b19a0b - std::panicking::rust_panic_with_hook::hd9708ed3eabf91e2
   5:     0x564322b1d725 - std::panicking::begin_panic_handler::{{closure}}::h5445e74fe4b5ee5a
   6:     0x564322b1d6b9 - std::sys::backtrace::__rust_end_short_backtrace::h66f5b0e9fcf722b5
   7:     0x564322b1910c - rust_begin_unwind
   8:     0x5643228eb58f - core::panicking::panic_fmt::he6504b56be805f60
   9:     0x5643228eb5eb - core::panicking::panic::h1a21611f9fc999c3
  10:     0x56432298d4c0 - ouch::commands::decompress::decompress_file::{{closure}}::h41e44f5b2b106fc9
  11:     0x5643229846bc - ouch::commands::decompress::decompress_file::h0922e5e4e251567e
  12:     0x56432295564a - rayon::iter::plumbing::bridge_producer_consumer::helper::h4431c82e8053362e
  13:     0x5643229a0493 - ouch::commands::run::h4275d680c615e3fa
  14:     0x5643229aaa00 - ouch::main::hb9a023afd77d8a91
  15:     0x5643229221f3 - std::sys::backtrace::__rust_begin_short_backtrace::h6d048bd3d44c1010
  16:     0x5643229b4f80 - main
  17:     0x7f64c14d91fe - __libc_start_call_main
  18:     0x7f64c14d92b9 - __libc_start_main_alias_2
  19:     0x5643228f5105 - _start
  20:                0x0 - <unknown>

Expected Behavior

It's a weird case, but it should work and only the last ending should be examined IMO. This happened when a friend sent me a zip from windows, and I suspect they had the "hide known file endings" option turned on and then renamed the file to something.zip before sending, which then turned the actual filename to something.zip.zip. Renaming the file fixes the issue, but this should be easy to fix in ouch as well I think.

I'll have a look soon if this isn't fixed already by then.

Additional Information

No response

*Originally created by @happenslol on 3/26/2025* ### Version 0.5.1 ### Description Reproducible with the following commands: ```bash # any file will do here echo "hello world" >> test ouch compress test test.zip mv test.zip test.zip.zip ouch decompress test.zip.zip ``` ### Current Behavior Full backtrace: ``` thread 'main' panicked at src/commands/decompress.rs:89:43: internal error: entered unreachable code stack backtrace: 0: 0x564322b1d0f9 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h7964c48fa1e13ebd 1: 0x564322a2d343 - core::fmt::write::h26d370e762806908 2: 0x564322b3373e - std::io::Write::write_fmt::h7172e38dd4e6c5be 3: 0x564322b1cf53 - std::sys::backtrace::BacktraceLock::print::hf0868af390127a97 4: 0x564322b19a0b - std::panicking::rust_panic_with_hook::hd9708ed3eabf91e2 5: 0x564322b1d725 - std::panicking::begin_panic_handler::{{closure}}::h5445e74fe4b5ee5a 6: 0x564322b1d6b9 - std::sys::backtrace::__rust_end_short_backtrace::h66f5b0e9fcf722b5 7: 0x564322b1910c - rust_begin_unwind 8: 0x5643228eb58f - core::panicking::panic_fmt::he6504b56be805f60 9: 0x5643228eb5eb - core::panicking::panic::h1a21611f9fc999c3 10: 0x56432298d4c0 - ouch::commands::decompress::decompress_file::{{closure}}::h41e44f5b2b106fc9 11: 0x5643229846bc - ouch::commands::decompress::decompress_file::h0922e5e4e251567e 12: 0x56432295564a - rayon::iter::plumbing::bridge_producer_consumer::helper::h4431c82e8053362e 13: 0x5643229a0493 - ouch::commands::run::h4275d680c615e3fa 14: 0x5643229aaa00 - ouch::main::hb9a023afd77d8a91 15: 0x5643229221f3 - std::sys::backtrace::__rust_begin_short_backtrace::h6d048bd3d44c1010 16: 0x5643229b4f80 - main 17: 0x7f64c14d91fe - __libc_start_call_main 18: 0x7f64c14d92b9 - __libc_start_main_alias_2 19: 0x5643228f5105 - _start 20: 0x0 - <unknown> ``` ### Expected Behavior It's a weird case, but it should work and only the last ending should be examined IMO. This happened when a friend sent me a zip from windows, and I suspect they had the "hide known file endings" option turned on and then renamed the file to `something.zip` before sending, which then turned the actual filename to `something.zip.zip`. Renaming the file fixes the issue, but this should be easy to fix in `ouch` as well I think. I'll have a look soon if this isn't fixed already by then. ### Additional Information _No response_
tcsenpai added the
bug
label 2025-04-09 14:58:09 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/ouch#10
No description provided.