Skip to content

fix: strip fractional seconds from 7z time field - #507

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:agent/pms-bug-bot/487cf764cf7d
Oct 14, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:agent/pms-bug-bot/487cf764cf7d

Conversation

@pengfeixx

@pengfeixx pengfeixx commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

fix: strip fractional seconds from 7z time field

  1. Root cause: new 7-Zip (24.09+) -slt output includes fractional
    seconds in Modified field (e.g. 2025-06-04 11:11:04.8826983),
    QDateTime::fromString with "yyyy-MM-dd hh:mm:ss" fails to parse,
    returning invalid QDateTime whose toSecsSinceEpoch returns 0
  2. Fix: truncate the fractional seconds part before calling
    QDateTime::fromString, compatible with both old and new 7-Zip
  3. Impact: only affects 7z archive Modified time parsing, no behavior
    change for archives without fractional seconds

Log: Fix 7z archive modified time displaying as 1970/01/01

Influence:

  1. Test opening 7z archives created by new 7-Zip (24.09+)
  2. Verify modified time displays correctly instead of 1970/01/01
  3. Test opening 7z archives created by old 7-Zip for no regression

fix: 截断7z修改时间字段的小数秒部分

  1. 根因:新版 7-Zip (24.09+) 的 -slt 输出中 Modified 字段带小数秒
    (如 2025-06-04 11:11:04.8826983),QDateTime::fromString 使用
    "yyyy-MM-dd hh:mm:ss" 格式解析失败返回无效 QDateTime,
    toSecsSinceEpoch 返回 0 即 1970/01/01
  2. 方案:在调用 QDateTime::fromString 前截断小数秒部分(小数点及
    之后),兼容新旧两种 7-Zip 时间格式
  3. 影响:仅影响 7z 压缩包 Modified 时间解析,对旧版 7-Zip 无小数秒
    输出完全向后兼容

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

Influence:

  1. 测试使用新版 7-Zip (24.09+) 创建的 7z 压缩包
  2. 验证修改时间正确显示而非 1970/01/01
  3. 测试旧版 7-Zip 创建的 7z 压缩包无回归

PMS: BUG-378795

Summary by Sourcery

Bug Fixes:

  • Fix parsing of 7z archive modification times emitted with fractional seconds so they display correctly instead of defaulting to the Unix epoch.

@sourcery-ai

sourcery-ai Bot commented Oct 13, 2026

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

Reviewer's Guide

The 7z plugin now truncates fractional seconds from newer 7-Zip -slt Modified fields before QDateTime parsing, preventing invalid timestamps from displaying as 1970/01/01 while retaining compatibility with older archives.

Sequence diagram for 7z modified time parsing

sequenceDiagram
    participant SevenZip as 7-Zip -slt
    participant Plugin as Cli7zPlugin
    participant DateTime as QDateTime
    participant Entry as FileEntry
    SevenZip->>Plugin: readListLine(line)
    Plugin->>Plugin: modifiedTime.indexOf('.')
    opt fractional seconds present
        Plugin->>Plugin: modifiedTime.truncate(dotIndex)
    end
    Plugin->>DateTime: fromString(modifiedTime, yyyy-MM-dd hh:mm:ss)
    DateTime-->>Plugin: valid parsed time
    Plugin->>Entry: set uLastModifiedTime
Loading

File-Level Changes

Change Details Files
Normalize 7-Zip Modified timestamps before parsing to support fractional-second output.
  • Extract the Modified field value and trim it.
  • Remove the decimal point and all following fractional digits when present.
  • Parse the normalized timestamp using the existing Qt-version-specific conversion path, preserving support for legacy output.
3rdparty/cli7zplugin/cli7zplugin.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 reviewed your changes and they look great!


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

1. Root cause: new 7-Zip (24.09+) -slt output includes fractional
   seconds in Modified field (e.g. 2025-06-04 11:11:04.8826983),
   QDateTime::fromString with "yyyy-MM-dd hh:mm:ss" fails to parse,
   returning invalid QDateTime whose toSecsSinceEpoch returns 0
2. Fix: truncate the fractional seconds part before calling
   QDateTime::fromString, compatible with both old and new 7-Zip
3. Impact: only affects 7z archive Modified time parsing, no behavior
   change for archives without fractional seconds

Log: Fix 7z archive modified time displaying as 1970/01/01

Influence:
1. Test opening 7z archives created by new 7-Zip (24.09+)
2. Verify modified time displays correctly instead of 1970/01/01
3. Test opening 7z archives created by old 7-Zip for no regression

fix: 截断7z修改时间字段的小数秒部分

1. 根因:新版 7-Zip (24.09+) 的 -slt 输出中 Modified 字段带小数秒
   (如 2025-06-04 11:11:04.8826983),QDateTime::fromString 使用
   "yyyy-MM-dd hh:mm:ss" 格式解析失败返回无效 QDateTime,
   toSecsSinceEpoch 返回 0 即 1970/01/01
2. 方案:在调用 QDateTime::fromString 前截断小数秒部分(小数点及
   之后),兼容新旧两种 7-Zip 时间格式
3. 影响:仅影响 7z 压缩包 Modified 时间解析,对旧版 7-Zip 无小数秒
   输出完全向后兼容

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

Influence:
1. 测试使用新版 7-Zip (24.09+) 创建的 7z 压缩包
2. 验证修改时间正确显示而非 1970/01/01
3. 测试旧版 7-Zip 创建的 7z 压缩包无回归

PMS: BUG-378795
multica: V-5746
@pengfeixx
pengfeixx force-pushed the agent/pms-bug-bot/487cf764cf7d branch from 82db3cc to 4cd2674 Compare October 14, 2026 02:13
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, 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

@pengfeixx

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
deepin-bot Bot merged commit 4f830e3 into linuxdeepin:master Oct 14, 2026
14 checks passed
@pengfeixx
pengfeixx deleted the agent/pms-bug-bot/487cf764cf7d branch October 14, 2026 03:35
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