Skip to content

revert: 2 changes about judgement of dtk version#342

Merged
deepin-bot[bot] merged 2 commits intolinuxdeepin:release/eaglefrom
LiHua000:release/eagle
Jan 15, 2026
Merged

revert: 2 changes about judgement of dtk version#342
deepin-bot[bot] merged 2 commits intolinuxdeepin:release/eaglefrom
LiHua000:release/eagle

Conversation

@LiHua000
Copy link
Copy Markdown
Contributor

@LiHua000 LiHua000 commented Jan 15, 2026

as title

Summary by Sourcery

Enhancements:

  • Update DTK version boundary to treat versions from 5.4.42.7 up to but below 5.5.0 as using the customized watermark interface.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jan 15, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the DTK version range used to detect the customized DTKWidget watermark interface, narrowing the upper bound from 5.6.8.10 to 5.5.0.0 in the version check macro.

File-Level Changes

Change Details Files
Narrow the DTK version upper bound for identifying the customized watermark interface.
  • Update the comment describing the DTK version range for customized watermark detection to use an upper limit of 5.5 instead of 5.6.9 with a special-case 5.6.8.10 mention.
  • Change the DTK_VERSION_CHECK macro condition so that the upper bound is DTK_VERSION_CHECK(5, 5, 0, 0) instead of DTK_VERSION_CHECK(5, 6, 8, 10).
src/main.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

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

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:

  • The inline comment still states that the mainline watermark interface is introduced after 5.6.9, but the conditional now treats versions < 5.5 as the custom line; please align the comment with the actual version bounds or update the condition if this revert is unintentional.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The inline comment still states that the mainline watermark interface is introduced after 5.6.9, but the conditional now treats versions < 5.5 as the custom line; please align the comment with the actual version bounds or update the condition if this revert is unintentional.

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.

@LiHua000
Copy link
Copy Markdown
Contributor Author

/merge

@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

@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot Bot commented Jan 15, 2026

This pr cannot be merged! (status: unstable)

@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

这段代码修改涉及 DTK 框架版本兼容性的条件判断,主要目的是调整对"定制线"版本范围的界定。以下是对该 git diff 的审查意见:

1. 语法逻辑

  • 版本宏使用正确:代码中 DTK_VERSION_CHECKDTK_VERSION 的宏使用符合 DTK 框架的常规用法。
  • 逻辑一致性:修改后的逻辑将版本上限从 5.6.8.10 调整为 5.5.0.0。这意味着代码现在认为版本在 [5.4.42.7, 5.5.0.0) 之间的为"定制线",并使用特定的结构体接口。
  • 潜在风险(边界条件)
    • 原代码注释中提到"部分镜像上存在 5.6.8.10 版本",这暗示在 5.5 到 5.6 之间可能存在一些过渡版本或特殊版本。将上限直接降到 5.5,如果运行环境是 5.5.x 或 5.6.x 的早期版本,且这些版本实际上仍然保留了旧的结构体接口(即属于"定制线"逻辑),那么这段代码将跳过#if 分支。
    • 后果:如果跳过该分支,代码后续是否有处理主线版本(>= 5.6.9)的 #elif#else 逻辑至关重要。如果后续逻辑默认使用主线接口,而实际运行环境(如 5.5.x)仍需定制线接口,将导致编译错误运行时崩溃(接口不匹配)。

2. 代码质量

  • 注释更新:代码注释已随之更新为"低于 5.5",这很好,保持了代码与注释的一致性。
  • 硬编码版本号:版本号硬编码在预处理器指令中是此类版本兼容性代码的常态,但也意味着每次版本变动都需要修改此处代码。建议确认是否有更通用的运行时检测方式(如检查特定的宏定义或函数是否存在),以减少对具体版本号的强依赖。

3. 代码性能

  • 无影响:这是编译期预处理器判断,对运行时性能没有任何影响。

4. 代码安全

  • 版本兼容性风险:这是最主要的安全隐患。如果构建环境或运行环境的 DTK 版本处于 5.5.0.05.6.9 之间(即 5.5, 5.6 系列),代码将不再认为它们是"定制线"。
    • 如果这些中间版本实际上没有主线的新接口,代码将尝试调用不存在的接口或访问不存在的成员,导致程序崩溃。
    • 建议:请务必确认 DTK 5.5 及 5.6 系列的所有版本是否都已完全切换到主线接口。如果没有,建议保留对特定版本(如原代码中的 5.6.8.10)的兼容判断,或者细化判断条件。

改进建议

  1. 确认版本历史:建议与 DTK 框架维护者或查阅变更日志,确认 5.5.x 和 5.6.x 版本中水印接口的具体引入时间。如果 5.5.x 仍然使用旧接口,这个修改会导致功能失效。
  2. 细化版本判断:如果 5.5.x 确实属于定制线,建议将判断逻辑修改为包含 5.5.x,例如:
    // 假设 5.5.0.0 到 5.5.99.99 仍使用旧接口
    #if DTK_VERSION_CHECK(5, 4, 42, 7) <= DTK_VERSION && DTK_VERSION < DTK_VERSION_CHECK(5, 6, 0, 0)
  3. 考虑运行时检测:如果可能,优先使用运行时特性检测(C++17 的 if constexpr 配合函数检测,或者简单的运行时 if 判断),而不是完全依赖编译期版本号,这样同一份二进制程序在不同版本的 DTK 库上可能有更好的适应性(前提是 ABI 兼容)。

总结:该修改在语法上没有问题,但在逻辑上缩小了"定制线"的版本范围。必须确保被排除在外的版本(5.5.0.0 及以上)确实不再需要这段旧代码的逻辑,否则会引入严重的兼容性 Bug。

@LiHua000
Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot deepin-bot Bot merged commit 7ab2d65 into linuxdeepin:release/eagle Jan 15, 2026
15 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