Skip to content

fix multiple panics on extraction#950

Merged
marcospb19 merged 4 commits into
ouch-org:mainfrom
curious-rabbit:bugfixes
Apr 28, 2026
Merged

fix multiple panics on extraction#950
marcospb19 merged 4 commits into
ouch-org:mainfrom
curious-rabbit:bugfixes

Conversation

@curious-rabbit
Copy link
Copy Markdown
Contributor

@curious-rabbit curious-rabbit commented Apr 19, 2026

A few bugs that cause panics or silently lose info

  • ouch list panics on a corrupt .bz3 file because Bz3Decoder::new is called with .unwrap(). decompress.rs already uses ? for the same call.
  • Tar compression panics if the file walker hits an I/O or permission error mid-walk (entry.unwrap() in archive/tar.rs). Zip and 7z already use ?.
  • 7z extraction silently drops mtime-set errors via .unwrap_or_default(), so users get files with wrong timestamps and no warning.
  • Typo in SUPPORTED_ALIASES: "tzlma" should be "tlzma" (every other place in the codebase uses tlzma).
  • ouch panics at startup if the current directory is unreadable or has been deleted (env::current_dir().expect(...) in main.rs).
  • --threads 0 is handled inconsistently: cli/mod.rs treats it as "auto" but commands/mod.rs still passes it to rayon, and build_global().unwrap() panics if the thread pool is already initialized.
  • ouch compress input1.txt input2.txt archive.bz3 --yes panics with "output path should contain a compression format" at src/check.rs

curious-rabbit and others added 2 commits April 28, 2026 20:06
Replace .expect() in check_invalid_compression_with_non_archive_format
with a fallback when build_archive_file_suggestion returns None.

Panic explained in issue ouch-org#942
@marcospb19 marcospb19 changed the title fix panic on extraction fix multiple panics on extraction Apr 28, 2026
@marcospb19 marcospb19 merged commit e141617 into ouch-org:main Apr 28, 2026
18 checks passed
@marcospb19
Copy link
Copy Markdown
Member

Thanks!

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.

Suggestion: Return CLI Errors Instead of Panicking on Invalid User Input

2 participants