Skip to content

fix: update Accounts D-Bus interface names to org.deepin.dde.Accounts1 - #600

Merged
caixr23 merged 1 commit into
linuxdeepin:masterfrom
caixr23:bug-dbus
Aug 10, 2026
Merged

fix: update Accounts D-Bus interface names to org.deepin.dde.Accounts1#600
caixr23 merged 1 commit into
linuxdeepin:masterfrom
caixr23:bug-dbus

Conversation

@caixr23

@caixr23 caixr23 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor
  1. Replace com.deepin.daemon.Accounts with org.deepin.dde.Accounts1 in accountInterface() for both service name and interface names
  2. Ensures D-Bus calls match the renamed account service on V25, preventing lookup failures during rollback/boot procedures

PMS: BUG-373169

Log: update Accounts D-Bus interface names to org.deepin.dde.Accounts1

Influence:

  1. 升级系统后执行回退流程,验证能否正常进入桌面
  2. 控制中心-系统-启动菜单-启动设置中选择回退并重启,验证系统正常启动

fix: 更新 Accounts D-Bus 接口名为 org.deepin.dde.Accounts1

  1. 将 accountInterface() 中的 com.deepin.daemon.Accounts 替换为 org.deepin.dde.Accounts1,同步更新服务名和接口名
  2. 确保 D-Bus 调用与 V25 上重命名后的账户服务一致, 避免回退/启动过程中查找失败

PMS: BUG-373169

Log: 更新 Accounts D-Bus 接口名为 org.deepin.dde.Accounts1

Influence:

  1. 升级系统后执行回退流程,验证能否正常进入桌面
  2. 控制中心-系统-启动菜单-启动设置中选择回退并重启,验证系统正常启动

Summary by Sourcery

Bug Fixes:

  • Align network initialization D-Bus calls with the renamed Accounts service to prevent lookup failures during rollback and boot flows.

1. Replace com.deepin.daemon.Accounts with org.deepin.dde.Accounts1
   in accountInterface() for both service name and interface names
2. Ensures D-Bus calls match the renamed account service on V25,
   preventing lookup failures during rollback/boot procedures

PMS: BUG-373169

Log: update Accounts D-Bus interface names to org.deepin.dde.Accounts1

Influence:
1. 升级系统后执行回退流程,验证能否正常进入桌面
2. 控制中心-系统-启动菜单-启动设置中选择回退并重启,验证系统正常启动

fix: 更新 Accounts D-Bus 接口名为 org.deepin.dde.Accounts1

1. 将 accountInterface() 中的 com.deepin.daemon.Accounts 替换为
   org.deepin.dde.Accounts1,同步更新服务名和接口名
2. 确保 D-Bus 调用与 V25 上重命名后的账户服务一致,
   避免回退/启动过程中查找失败

PMS: BUG-373169

Log: 更新 Accounts D-Bus 接口名为 org.deepin.dde.Accounts1

Influence:
1. 升级系统后执行回退流程,验证能否正常进入桌面
2. 控制中心-系统-启动菜单-启动设置中选择回退并重启,验证系统正常启动

@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.

Sorry @caixr23, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@sourcery-ai

sourcery-ai Bot commented Aug 10, 2026

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

Reviewer's Guide

This PR updates the D-Bus service and interface names used by NetworkInitialization::accountInterface to align with the renamed Accounts service org.deepin.dde.Accounts1, ensuring account lookups work correctly on V25 during rollback and boot flows.

File-Level Changes

Change Details Files
Update D-Bus Accounts service and interface names used for account lookups to org.deepin.dde.Accounts1.
  • Change user account interface string from com.deepin.daemon.Accounts.User to org.deepin.dde.Accounts1.User.
  • Change non-user account interface string from com.deepin.daemon.Accounts to org.deepin.dde.Accounts1.
  • Change QDBusInterface service name from com.deepin.daemon.Accounts to org.deepin.dde.Accounts1 in accountInterface().
network-service-plugin/src/system/networkinitialization.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

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: caixr23, fly602

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-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:95分

■ 【总体评价】

代码正确适配了新版DBus接口名称,但缺乏对DBus调用失败的错误处理机制
逻辑正确但因缺少DBus连接有效性校验扣5分

■ 【详细分析】

  • 1.语法逻辑(基本正确)✓

networkinitialization.cppNetworkInitialization::accountInterface 函数中,根据 isUser 参数正确拼接了 org.deepin.dde.Accounts1 及其子接口 org.deepin.dde.Accounts1.User,并成功替换了旧版服务名。但直接返回 dbus.property() 的结果,未检查 QDBusInterface 对象是否成功连接到底层系统总线。
潜在问题:当底层的 org.deepin.dde.Accounts1 服务未启动或传入的 path 无效时,QDBusInterface 会处于无效状态,此时 property() 会返回一个无效的 QVariant,若调用方未做二次校验直接进行类型转换(如 toInt()toString()),可能引发程序逻辑异常或非预期的默认值填充。
建议:在调用 property() 前增加 dbus.isValid() 判断,若无效则记录警告日志并提前返回空 QVariant

  • 2.代码质量(符合规范)✓

代码结构清晰,分支逻辑简单明了,符合Qt及C++常规编码风格。字符串字面量直接写在条件分支中,对于此类极少变动的底层DBus接口名而言在可接受范围内。
潜在问题:无
建议:若项目规范要求严格,可将 org.deepin.dde.Accounts1 等字符串提取为文件级别的 static constexpr 常量,防止拼写错误并提升可维护性。

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

函数内部仅进行简单的字符串赋值与一次跨进程DBus属性读取,属于标准的IPC调用开销,不存在死循环、冗余计算或内存频繁分配等性能瓶颈。
建议:无

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

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
代码使用Qt封装的 QDBusInterfaceQDBusConnection::systemBus() 进行安全的跨进程通信。传入的 pathkey 参数在底层会被DBus协议安全地序列化与反序列化,无法被利用来执行命令注入或越权访问。系统总线的访问受限于Linux底层的DBus守护进程策略控制,不存在安全漏洞。

建议:无

■ 【改进建议代码示例】

diff --git a/network-service-plugin/src/system/networkinitialization.cpp b/network-service-plugin/src/system/networkinitialization.cpp
index 06de55913..safe_account_iface 100755
--- a/network-service-plugin/src/system/networkinitialization.cpp
+++ b/network-service-plugin/src/system/networkinitialization.cpp
@@ -303,11 +303,17 @@ QVariant NetworkInitialization::accountInterface(const QString &path, const QStr
 {
     QString interfaceName;
     if (isUser) {
         interfaceName = "org.deepin.dde.Accounts1.User";
     } else {
         interfaceName = "org.deepin.dde.Accounts1";
     }
     QDBusInterface dbus("org.deepin.dde.Accounts1", path, interfaceName, QDBusConnection::systemBus());
+
+    if (!dbus.isValid()) {
+        qCWarning(networkLog) << "Failed to create DBus interface for" << path 
+                              << dbus.lastError().message();
+        return QVariant();
+    }
+
     return dbus.property(key.toLocal8Bit().constData());
 }

@caixr23
caixr23 merged commit 4e3be08 into linuxdeepin:master Aug 10, 2026
17 checks passed
@caixr23
caixr23 deleted the bug-dbus branch August 10, 2026 05:03
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