Skip to content

fix: truncate fractional seconds in 7-Zip Modified time - #506

Closed
pengfeixx wants to merge 1 commit into
linuxdeepin:masterfrom
pengfeixx:agent/bug/bf1e7649c5b9
Closed

pengfeixx wants to merge 1 commit into
linuxdeepin:masterfrom
pengfeixx:agent/bug/bf1e7649c5b9

Conversation

@pengfeixx

@pengfeixx pengfeixx commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

fix: truncate fractional seconds in 7-Zip Modified time

  1. Root cause: new 7-Zip (24.09+/26.x) -slt output includes
    fractional seconds in "Modified" field (e.g. 2025-06-04
    11:11:04.8826983), QDateTime::fromString with format
    "yyyy-MM-dd hh:mm:ss" fails to parse, returns invalid QDateTime
  2. Fix: truncate the fractional seconds part (dot and after) before
    calling fromString, so both old and new 7-Zip time formats work
  3. Impact: archive Modified time now displays correctly instead of
    1970/01/01; no effect on archives without fractional seconds

Log: Fix archive file Modified time showing as 1970/01/01

Influence:

  1. Test opening 7z archives created by new 7-Zip with fractional
    seconds in Modified field
  2. Test opening 7z archives created by old 7-Zip without fractional
    seconds
  3. Verify Modified time displays correctly for various archive types

fix: 截断7-Zip Modified时间字段的小数秒部分

  1. 根因:新版7-Zip(24.09+/26.x)的-slt输出中"Modified"字段带小数秒
    (如2025-06-04 11:11:04.8826983),QDateTime::fromString使用
    "yyyy-MM-dd hh:mm:ss"格式解析失败,返回无效QDateTime
  2. 方案:在调用fromString前截断小数秒部分(小数点及之后内容),
    兼容新旧两种7-Zip时间格式
  3. 影响:修复后压缩包修改时间正常显示,不再显示为1970/01/01;
    对不含小数秒的旧格式压缩包无影响

Log: 修复压缩包文件修改时间显示为1970/01/01的问题

Influence:

  1. 测试使用新版7-Zip创建的带小数秒Modified字段的7z压缩包
  2. 测试使用旧版7-Zip创建的不带小数秒的7z压缩包
  3. 验证各种压缩包类型的修改时间显示正确

PMS: BUG-378795

Summary by Sourcery

Ensure 7-Zip archive Modified timestamps are parsed correctly across timestamp formats.

Bug Fixes:

  • Fix archive Modified timestamps displaying as 1970/01/01 when newer 7-Zip versions include fractional seconds in the timestamp.

Enhancements:

  • Support both fractional and non-fractional 7-Zip Modified timestamp formats.

1. Root cause: new 7-Zip (24.09+/26.x) -slt output includes
   fractional seconds in "Modified" field (e.g. 2025-06-04
   11:11:04.8826983), QDateTime::fromString with format
   "yyyy-MM-dd hh:mm:ss" fails to parse, returns invalid QDateTime
2. Fix: truncate the fractional seconds part (dot and after) before
   calling fromString, so both old and new 7-Zip time formats work
3. Impact: archive Modified time now displays correctly instead of
   1970/01/01; no effect on archives without fractional seconds

Log: Fix archive file Modified time showing as 1970/01/01

Influence:
1. Test opening 7z archives created by new 7-Zip with fractional
   seconds in Modified field
2. Test opening 7z archives created by old 7-Zip without fractional
   seconds
3. Verify Modified time displays correctly for various archive types

fix: 截断7-Zip Modified时间字段的小数秒部分

1. 根因:新版7-Zip(24.09+/26.x)的-slt输出中"Modified"字段带小数秒
   (如2025-06-04 11:11:04.8826983),QDateTime::fromString使用
   "yyyy-MM-dd hh:mm:ss"格式解析失败,返回无效QDateTime
2. 方案:在调用fromString前截断小数秒部分(小数点及之后内容),
   兼容新旧两种7-Zip时间格式
3. 影响:修复后压缩包修改时间正常显示,不再显示为1970/01/01;
   对不含小数秒的旧格式压缩包无影响

Log: 修复压缩包文件修改时间显示为1970/01/01的问题

Influence:
1. 测试使用新版7-Zip创建的带小数秒Modified字段的7z压缩包
2. 测试使用旧版7-Zip创建的不带小数秒的7z压缩包
3. 验证各种压缩包类型的修改时间显示正确

PMS: BUG-378795
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pengfeixx

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

@sourcery-ai

sourcery-ai Bot commented Oct 13, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates 7-Zip Modified-time parsing to truncate fractional seconds before applying the existing second-precision format, preventing invalid dates and restoring correct archive timestamps for both new and legacy 7-Zip output.

Sequence diagram for 7-Zip Modified time parsing

sequenceDiagram
    participant SevenZip as 7-Zip
    participant Plugin as Cli7zPlugin
    participant Qt as QDateTime

    SevenZip->>Plugin: readListLine(line)
    Plugin->>Plugin: line.mid(11).trimmed()
    opt fractional seconds present
        Plugin->>Plugin: modifiedTime.truncate(dotIndex)
    end
    Plugin->>Qt: fromString(modifiedTime, yyyy-MM-dd hh:mm:ss)
    Qt-->>Plugin: valid archive Modified time
Loading

File-Level Changes

Change Details Files
Normalize 7-Zip archive timestamps before parsing to support fractional-second output.
  • Extract the Modified field value and remove the decimal point and all following fractional digits.
  • Parse the normalized timestamp with the existing Qt-version-specific conversion path, preserving compatibility with timestamps that have no fractional seconds.
3rdparty/cli7zplugin/cli7zplugin.cpp
Add pull-request metadata for the bug fix.
  • Record the BUG-378795 fix details and test influence notes in the commit message file.
fix/378795/commit-msg.txt

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 reviewed your changes and they look great!


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

@pengfeixx pengfeixx closed this Oct 14, 2026
@pengfeixx
pengfeixx deleted the agent/bug/bf1e7649c5b9 branch October 14, 2026 02:11
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.

2 participants