Skip to content

fix: suppress rename-phase progress and reset bar before long-name ex…#440

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:release/eaglefrom
LiHua000:release/eagle
Jul 21, 2026
Merged

fix: suppress rename-phase progress and reset bar before long-name ex…#440
deepin-bot[bot] merged 1 commit into
linuxdeepin:release/eaglefrom
LiHua000:release/eagle

Conversation

@LiHua000

@LiHua000 LiHua000 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

…tract

Two fixes for long-name ZIP extraction (PMS #370449):

  1. Suppress progress emission during the 7z rn (rename) phase in handleProgress. ZipCrypto only encrypts file content, not names, so 7z rn runs without a password and reports progress — causing the bar to jump ahead before the password dialog appears. Now the rename phase is silent; real progress starts only in the extract phase.

  2. Emit a progress-reset sentinel (signalprogress(-1.0)) when onLongNameProcessFinished transitions from LNE_Rename to LNE_Extract. MainWindow::slotReceiveProgress catches the negative value and calls ProgressPage::resetProgress, so the extract phase starts from 0 and the remaining-time calculation is correct instead of stuck at 00:00:01.

Log: fix progress bar jump and remaining-time stuck for encrypted ZIP with long filenames
Bug: https://pms.uniontech.com/bug-view-370449.html

Summary by Sourcery

Fix progress handling for long-filename ZIP extraction by suppressing rename-phase updates and resetting the progress bar when switching to the extract phase.

Bug Fixes:

  • Prevent the progress bar from jumping ahead during the long-filename rename phase of encrypted ZIP extraction.
  • Reset the progress bar and remaining-time calculation when transitioning from the long-filename rename phase to the extract phase to avoid a stuck remaining-time display.

…tract

Two fixes for long-name ZIP extraction (PMS #370449):

1. Suppress progress emission during the 7z rn (rename) phase in
   handleProgress. ZipCrypto only encrypts file content, not names,
   so 7z rn runs without a password and reports progress — causing the
   bar to jump ahead before the password dialog appears. Now the rename
   phase is silent; real progress starts only in the extract phase.

2. Emit a progress-reset sentinel (signalprogress(-1.0)) when
   onLongNameProcessFinished transitions from LNE_Rename to LNE_Extract.
   MainWindow::slotReceiveProgress catches the negative value and calls
   ProgressPage::resetProgress, so the extract phase starts from 0 and
   the remaining-time calculation is correct instead of stuck at
   00:00:01.

Log: fix progress bar jump and remaining-time stuck for encrypted ZIP with long filenames
Bug: https://pms.uniontech.com/bug-view-370449.html
@sourcery-ai

sourcery-ai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Reviewer's Guide

Suppresses misleading progress updates during the 7z long-filename rename phase and introduces a sentinel-based progress reset when transitioning to the actual extract phase, so the progress bar and remaining-time calculations correctly reflect only the real extraction work.

Sequence diagram for long-name ZIP progress handling

sequenceDiagram
    participant CliInterface
    participant QProcess7z as QProcess7z
    participant MainWindow
    participant ProgressPage

    QProcess7z->>CliInterface: handleProgress(line)
    alt m_longNamePhase == LNE_Rename
        CliInterface-->>QProcess7z: return (suppress progress)
    else m_longNamePhase == LNE_Extract
        CliInterface-->>MainWindow: signalprogress(dPercentage)
    end

    CliInterface->>CliInterface: onLongNameProcessFinished(exitCode, exitStatus)
    alt m_longNamePhase == LNE_Rename
        CliInterface->>CliInterface: m_longNamePhase = LNE_Extract
        CliInterface-->>MainWindow: signalprogress(-1.0)
    end

    MainWindow->>MainWindow: slotReceiveProgress(dPercentage)
    alt dPercentage < 0
        MainWindow->>ProgressPage: resetProgress()
    else dPercentage >= 0
        MainWindow->>ProgressPage: updateProgress(dPercentage)
    end
Loading

File-Level Changes

Change Details Files
Ignore progress output from the long-filename rename (LNE_Rename) phase so only real extraction progress is reported.
  • Early-return from progress handling when the long-filename phase is LNE_Rename
  • Document rationale in comments: 7z rn emits progress without password while ZipCrypto encrypts only content, causing premature UI progress
3rdparty/interface/archiveinterface/cliinterface.cpp
Reset the progress UI via a sentinel value when transitioning from rename to extract in long-filename workflows.
  • On LNE_Rename→LNE_Extract transition, emit signalprogress(-1.0) as a reset sentinel before starting the extract program
  • Handle negative progress values in MainWindow::slotReceiveProgress by calling ProgressPage::resetProgress and returning early
  • Explain in comments that the reset covers any leaked progress (e.g., from extractFiles emitting 1.0 or non-handleProgress paths) so extract starts from 0 with correct remaining-time computation
3rdparty/interface/archiveinterface/cliinterface.cpp
src/source/mainwindow.cpp

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

@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 left some high level feedback:

  • Consider replacing the magic sentinel value -1.0 for progress reset with a named constant or enum so its meaning is self‑documenting and easier to reuse or change safely.
  • In slotReceiveProgress, it may be worth guarding m_pProgressPage before calling resetProgress() to avoid potential null pointer issues during initialization or teardown paths.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider replacing the magic sentinel value `-1.0` for progress reset with a named constant or enum so its meaning is self‑documenting and easier to reuse or change safely.
- In `slotReceiveProgress`, it may be worth guarding `m_pProgressPage` before calling `resetProgress()` to avoid potential null pointer issues during initialization or teardown paths.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:95分

■ 【总体评价】

代码通过引入阶段判断和负值哨兵有效修复了长文件名解压进度卡死的问题
逻辑正确且注释详尽,无安全漏洞,代码质量优秀扣5分

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓

CliInterface::handleProgress 中正确添加了 m_longNamePhase == LNE_Rename 的判断并提前返回,阻止了 rename 阶段的进度上报;在 CliInterface::onLongNameProcessFinished 中于阶段切换时发送 signalprogress(-1.0) 哨兵;在 MainWindow::slotReceiveProgress 中正确捕获负值并调用 resetProgress(),逻辑闭环完整。
潜在问题:无
建议:无

  • 2.代码质量(优秀)✓

新增代码包含非常详细的注释,准确解释了问题根因(ZipCrypto 不加密文件名导致进度提前泄露、UI 单调递增逻辑导致后续进度被丢弃)以及修复策略,极大地提高了代码可读性和可维护性。命名规范,符合现有代码风格。
潜在问题:使用魔法数字 -1.0 作为哨兵值,虽然注释清晰,但在多处使用时可能存在维护风险。
建议:可考虑定义一个具名常量,如 static constexpr double PROGRESS_RESET_SENTINEL = -1.0;,以增强代码自解释性。

  • 3.代码性能(无性能问题)✓

新增逻辑仅为简单的浮点数比较和条件分支,以及一次信号发送,无额外计算开销或资源消耗,对整体性能无负面影响。
潜在问题:无
建议:无

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
总体风险描述:本次修改仅涉及进度条状态控制逻辑,未引入外部输入处理或系统命令执行,不存在安全风险。
建议:无需修复。

■ 【改进建议代码示例】

// 建议在头文件或合适位置定义哨兵常量
// constexpr double PROGRESS_RESET_SENTINEL = -1.0;

void CliInterface::onLongNameProcessFinished(int exitCode, QProcess::ExitStatus)
{
    // ...
    if (m_longNamePhase == LNE_Rename) {
        m_longNamePhase = LNE_Extract;
        // rename→extract 阶段切换时重置进度条。
        // 虽然已在 handleProgress 中屏蔽了 rename 阶段的进度上报,
        // 但 extractFiles 入口处可能已 emit 过 signalprogress(1),
        // 且 rename 阶段可能有少量进度泄露(非 handleProgress 路径)。
        // 这里用负值作为重置哨兵,由 MainWindow::slotReceiveProgress 捕获并调用 resetProgress(),
        // 确保 extract 阶段的进度从 0 开始单调递增,剩余时间计算正确。
        emit signalprogress(PROGRESS_RESET_SENTINEL); // 使用常量替代魔法数字
        QString program = m_cliProps->property("extractProgram").toString();
        // ...
    }
}

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: LiHua000, max-lvs

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@LiHua000

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
deepin-bot Bot merged commit 30c6792 into linuxdeepin:release/eagle Jul 21, 2026
17 checks passed
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.

3 participants