Skip to content

fix: readable error messages for rar extraction failures - #1101

Open
DG-Elom wants to merge 1 commit into
ouch-org:mainfrom
DG-Elom:fix/rar-error-messages
Open

DG-Elom wants to merge 1 commit into
ouch-org:mainfrom
DG-Elom:fix/rar-error-messages

Conversation

@DG-Elom

@DG-Elom DG-Elom commented Oct 14, 2026

Copy link
Copy Markdown

Part of #808 (point 1: a clearer error when unrar fails).

Previously a failure reported by unrar was shown as e.g.

[ERROR] Unexpected error in rar archive
 - Could not create file

without the entry concerned nor any hint. This maps unrar's Code/When to a descriptive message with hints (file name too long / permissions for ECreate, corrupted archive for BadData/BadArchive, missing or wrong password -> --password, etc.) and reports the archive entry being extracted:

[ERROR] failed to extract "aaaa…"
 - could not create the output file

hint: The file name might be longer than the file system allows (usually 255 bytes)
hint: Also check the write permissions and the free space of the destination directory

Adds a UI snapshot test with a small RAR5 fixture (350 bytes, stored) whose single entry name is 300 bytes, which triggers ECreate. Other codes fall back to unrar's own text when not mapped.

Tested with --no-default-features --features unrar,use_zlib,use_zstd_thin (bzip3 needs libclang, which I don't have locally) and without the unrar feature; clippy and nightly rustfmt are clean.

Not covered: skipping failing entries and extracting a single file (points 2 and 3 of the issue).

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.

1 participant