Skip to content

fix: recognise the unrar 7 "use current password?" prompt - #546

Open
liuwenhuan wants to merge 1 commit into
linuxdeepin:masterfrom
liuwenhuan:fix-unrar7-multi-password-prompt
Open

liuwenhuan wants to merge 1 commit into
linuxdeepin:masterfrom
liuwenhuan:fix-unrar7-multi-password-prompt

Conversation

@liuwenhuan

@liuwenhuan liuwenhuan commented Nov 9, 2026 •

Copy link
Copy Markdown

When the file data of a RAR archive is encrypted but its headers are not (rar a -p<password>), unrar asks for the password of the first file and then, for every following file, whether to reuse it. unrar 7 changed that prompt:

  • unrar 5/6: <file> - use current password ? [Y]es, [N]o, [A]ll
  • unrar 7 (Debian trixie 7.1.8, deepin 25 7.2.7): <file> - use current password? [Y]es, [N]o, [A]ll (no space before ?)

CliRarPlugin::isMultiPasswordPrompt() only matched the old text. With unrar 7 the prompt is never answered, unrar waits on the pty for ever, and the progress page stays at 1 % with speed and remaining time "calculating". Only the first file of the archive gets extracted.

This change accepts both texts and adds test cases with the unrar 7 wording. The patch applies unchanged to master (6.5.40).

Tested (deepin-compressor 6.5.32.3 Qt6 build, unrar 7.1.8; "Extract here" from the file manager command line):

  • RAR5 test archive: 4 files including a 12 MB file spanning 4 volumes (rar a -ma5 -p... -v5m), headers not encrypted.
  • Without the fix: the password dialog appears, readme.txt is extracted, then the progress page hangs and unrar keeps waiting.
  • With the fix: the password is entered once, all 4 files are extracted, and their sha256 sums match the originals.
  • A real 5-volume, 18 GB archive (1745 entries) also hangs at the same prompt with unrar 7.23.

I could not build the unit tests: tests/UnitTest looks for the Qt5 dtkwidget and our environment is Qt6 only. The added EXPECT_EQ lines follow the existing cases.


RAR 包只加密数据、不加密文件头时,unrar 7 把"是否沿用当前密码"的提示改成了 use current password?(问号前没有空格)。isMultiPasswordPrompt() 只认旧写法,这个提示得不到回答,解压一直停在 1%,速度和剩余时间显示"计算中"。本补丁两种写法都识别,并补充了测试用例。

Summary by Sourcery

Support unrar 7's updated reuse-password prompt so multi-file encrypted RAR archives extract completely.

Bug Fixes:

  • Recognize both legacy and unrar 7 wording for prompts that ask whether to reuse the current password, preventing encrypted multi-file RAR extraction from hanging after the first file.

Tests:

  • Add coverage for the unrar 7 password prompt wording and ensure unrelated extraction output is not misidentified.

1. When the file data of a RAR archive is encrypted but the headers are not,
   unrar asks for the password of the first file and then, for each following
   file, whether to reuse it. unrar 7 prints
   "<file> - use current password? [Y]es, [N]o, [A]ll" (no space before '?');
   unrar 5/6 printed "use current password ? [Y]es, [N]o, [A]ll".
2. isMultiPasswordPrompt() only matched the old text, so with unrar 7 the
   prompt was never answered: unrar waited on the pty and the progress page
   stayed at 1 % for ever.
3. Accept both texts; add test cases with the unrar 7 wording.

Log: Fix extraction of encrypted RAR archives hanging at 1 % with unrar 7.

Influence:
1. With unrar 7.x, extract a RAR5 archive of several files created with
   "rar a -p<password>" (headers not encrypted), single and multi-volume;
   enter the password once; extraction completes.
2. The unrar 5/6 prompt is still recognised.

fix: 识别 unrar 7 的 "use current password?" 提示

1. RAR 包只加密文件数据、不加密文件头时,unrar 先询问第一个文件的密码,
   之后对每个文件询问是否沿用当前密码。unrar 7 的提示是
   "<文件> - use current password? [Y]es, [N]o, [A]ll"(问号前没有空格),
   unrar 5/6 是 "use current password ? [Y]es, [N]o, [A]ll"。
2. isMultiPasswordPrompt() 只匹配旧写法,unrar 7 下这个提示得不到回答,
   unrar 一直在 pty 上等待,进度页面停在 1%。
3. 两种写法都识别,并补充 unrar 7 写法的测试用例。

Log: 修复 unrar 7 下解压加密 RAR 包卡在 1% 的问题。

Influence:
1. 使用 unrar 7.x 解压 "rar a -p<密码>" 创建的多文件 RAR5 包(文件头不加密),
   含分卷;只输入一次密码,解压完成。
2. unrar 5/6 的提示仍能识别。
@sourcery-ai

sourcery-ai Bot commented Nov 9, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Recognize both the unrar 5/6 and unrar 7 spellings of the current-password prompt so extraction can continue.

  • 3rdparty/clirarplugin/clirarplugin.cpp L151-153

Tests

Add unit-test coverage for the unrar 7 prompt wording and confirm ordinary extraction output is not mistaken for a password prompt.

  • tests/UnitTest/3rdparty/clirarplugin/ut_clirarplugin.cpp L182-184, L321

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T00:14:03.824020Z ee89ee5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

CLA Assistant Lite bot:

如果你是以企业贡献者的身份进行提交,请联系我们签署企业贡献者许可协议
If you submit as corporate contributor, please contact us to sign our Corporate Contributor License Agreement

感谢您的提交,我们非常感谢。 像许多开源项目一样,在接受您的贡献之前,我们要求您签署我们的个人贡献者许可协议。 您只需发布与以下格式相同的评论即可签署个人贡献者许可协议。
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Individual Contributor License Agreement before we can accept your contribution. You can sign the Individual Contributor License Agreement by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA.

You can retrigger this bot by commenting recheck in this Pull Request

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

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