Skip to content

fix: add missing D-Bus activation files for FileNameIndex and OcrIndex - #297

Merged
Johnson-zs merged 1 commit into
linuxdeepin:develop/snipefrom
Johnson-zs:agent/bugfix/613a52e685a9
Nov 19, 2026
Merged

Johnson-zs merged 1 commit into
linuxdeepin:develop/snipefrom
Johnson-zs:agent/bugfix/613a52e685a9

Conversation

@Johnson-zs

@Johnson-zs Johnson-zs commented Nov 19, 2026 •

Copy link
Copy Markdown

Root Cause Analysis

deepin-anything-index registers three D-Bus service names (TextIndex, FileNameIndex, OcrIndex) in serviceentry.cpp:31-45, but only TextIndex has a .service activation file. When the service is stopped, D-Bus cannot auto-activate the process for FileNameIndex or OcrIndex method calls — it returns ServiceUnknown. On the dde-file-manager side, AbstractIndexController::setupDBusConnections() uses std::call_once to start the service only once, so after the service stops, subsequent calls to FileNameIndex/OcrIndex fail.

Fix

Add org.deepin.Filemanager.FileNameIndex.service and org.deepin.Filemanager.OcrIndex.service under assets/dbus/, with the same Exec and SystemdService as TextIndex.service. Update CMakeLists.txt to install all three .service files to dbus-1/services/.

Change Safety Assessment

Code Safety

  • Risk Level: Low
  • Only adds 2 new D-Bus .service config files and extends the install(FILES ...) list in CMakeLists.txt. No function signatures changed, no public APIs modified.
  • Historical insight: TextIndex.service was introduced by commit 8d481bc (service migration). FileNameIndex.service and OcrIndex.service never existed — this is a migration omission, not a regression of a prior fix.

Business Impact Scope

  • File Index: After service stop, clicking "File Index" now auto-activates deepin-anything-index.service (via FileIndexController)
  • Image Text Content Index: After service stop, clicking "Image Text Content Index" now auto-activates the service (via OcrIndexController)
  • Full Text Index: Unaffected — existing TextIndex.service unchanged

Verification Suggestion

Stop deepin-anything-index.service, then click "File Index", "Image Text Content Index", and "Full Text Index" separately — verify all three activate the service and start indexing. Verify three .service files are installed in dbus-1/services/.


根因分析

deepin-anything-index 进程在 serviceentry.cpp:31-45 注册了三个 D-Bus 服务名(TextIndex、FileNameIndex、OcrIndex),但仅有 TextIndex 存在 .service 激活文件。服务停止后,D-Bus 收到对 FileNameIndex/OcrIndex 的方法调用时找不到激活文件,返回 ServiceUnknown。dde-file-manager 侧 AbstractIndexController::setupDBusConnections() 通过 std::call_once 仅执行一次 startService,服务停止后不会再次触发激活。

修复方案

在 assets/dbus/ 下新增 FileNameIndex.service 和 OcrIndex.service,Exec 和 SystemdService 与 TextIndex.service 一致;更新 CMakeLists.txt 安装规则一并安装三个文件。

改动安全评估

代码安全评估

  • 风险等级: 低风险
  • 仅新增 2 个 D-Bus .service 配置文件,扩展 CMakeLists.txt 的 install(FILES ...) 列表,不修改任何函数签名或公开接口。
  • 历史洞察:TextIndex.service 由 commit 8d481bc(服务迁移)引入,FileNameIndex.service 和 OcrIndex.service 从未存在——迁移遗漏,非历史修复回退。

业务影响范围

  • 文件索引:服务停止后点击"文件索引"可自动激活服务(FileIndexController)
  • 图片文本内容索引:服务停止后点击"图片文本内容索引"可自动激活服务(OcrIndexController)
  • 全文索引:不受影响(现有 TextIndex.service 未修改)

验证建议

停止 deepin-anything-index.service 后分别点击"文件索引"、"图片文本内容索引"、"全文索引",验证三者均可激活服务并开始索引更新。验证 dbus-1/services/ 目录下三个 .service 文件均已安装。

Summary by Sourcery

Enable D-Bus auto-activation for all deepin-anything index services so file, OCR, and text indexing continue to work after the service stops.

New Features:

  • Add D-Bus activation support for the FileNameIndex and OcrIndex services.

Bug Fixes:

  • Ensure FileNameIndex and OcrIndex requests can automatically restart the indexing service after it has stopped.

Build:

  • Install the TextIndex, FileNameIndex, and OcrIndex D-Bus service activation files.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Johnson-zs

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 Nov 19, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Configuration

Add activation files for FileNameIndex and OcrIndex and update installation rules so all three D-Bus services are packaged.

  • debian/deepin-anything-index.install L8-9
  • src/index/CMakeLists.txt L149-152
  • src/index/assets/dbus/org.deepin.Filemanager.FileNameIndex.service L1-4
  • src/index/assets/dbus/org.deepin.Filemanager.OcrIndex.service L1-4

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 found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/index/CMakeLists.txt" line_range="151-152" />
<code_context>
-install(FILES assets/dbus/org.deepin.Filemanager.TextIndex.service
+install(FILES
+        assets/dbus/org.deepin.Filemanager.TextIndex.service
+        assets/dbus/org.deepin.Filemanager.FileNameIndex.service
+        assets/dbus/org.deepin.Filemanager.OcrIndex.service
     DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/dbus-1/services)
 # The three interface XMLs in assets/dbus/ are the canonical source for
</code_context>
<issue_to_address>
**New D-Bus names cannot activate**

When the project is built and installed through Debian packaging, `dh_install` reads `debian/deepin-anything-index.install`, which lists only the TextIndex activation file, so the FileNameIndex and OcrIndex files are omitted from the package and requests for those names return `ServiceUnknown` after the service stops.

Add both new activation file paths to `debian/deepin-anything-index.install`.
</issue_to_address>

### Comment 2
<location path="src/index/CMakeLists.txt" line_range="151-152" />
<code_context>
-install(FILES assets/dbus/org.deepin.Filemanager.TextIndex.service
+install(FILES
+        assets/dbus/org.deepin.Filemanager.TextIndex.service
+        assets/dbus/org.deepin.Filemanager.FileNameIndex.service
+        assets/dbus/org.deepin.Filemanager.OcrIndex.service
     DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/dbus-1/services)
 # The three interface XMLs in assets/dbus/ are the canonical source for
</code_context>
<issue_to_address>
**Fallback activation cannot start service**

When the D-Bus broker cannot use systemd activation and falls back to `Exec`, both new service files point `Exec` to `/usr/bin/deepin-anything-index`, which the package does not install, so D-Bus activation fails to start the index service.

Install the index executable at `/usr/bin/deepin-anything-index` or change both `Exec` paths to its installed location.
</issue_to_address>

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

Comment thread src/index/CMakeLists.txt Resolved
Comment thread src/index/CMakeLists.txt
Comment on lines +151 to +152
assets/dbus/org.deepin.Filemanager.FileNameIndex.service
assets/dbus/org.deepin.Filemanager.OcrIndex.service

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Fallback activation cannot start service

When the D-Bus broker cannot use systemd activation and falls back to Exec, both new service files point Exec to /usr/bin/deepin-anything-index, which the package does not install, so D-Bus activation fails to start the index service.

Install the index executable at /usr/bin/deepin-anything-index or change both Exec paths to its installed location.

Prompt for AI agents
In `src/index/CMakeLists.txt` at lines 151-152:

**Fallback activation cannot start service**

When the D-Bus broker cannot use systemd activation and falls back to `Exec`, both new service files point `Exec` to `/usr/bin/deepin-anything-index`, which the package does not install, so D-Bus activation fails to start the index service.

Install the index executable at `/usr/bin/deepin-anything-index` or change both `Exec` paths to its installed location.

1. Root cause: deepin-anything-index registers three D-Bus service
   names (TextIndex, FileNameIndex, OcrIndex) in serviceentry.cpp,
   but only TextIndex has a .service activation file; the other two
   cannot be auto-activated by D-Bus when the service is stopped
2. Fix: add org.deepin.Filemanager.FileNameIndex.service and
   org.deepin.Filemanager.OcrIndex.service under assets/dbus/, both
   pointing to the same Exec and SystemdService as TextIndex.service;
   update CMakeLists.txt install rule to deploy all three
3. Impact: file index and OCR index now auto-start the service like
   full-text index already does; no change to existing TextIndex
   behavior or any function signatures

Log: 文件索引和图片文本内容索引在服务停止后可自动激活索引服务

Influence:
1. Stop deepin-anything-index.service, click "File Index" and verify
   the service activates and indexing starts
2. Stop the service, click "Image Text Content Index" and verify the
   service activates and indexing starts
3. Stop the service, click "Full Text Index" and verify no regression
4. Verify three .service files are installed in dbus-1/services/

fix: 补全 FileNameIndex 和 OcrIndex 的 D-Bus 激活文件

1. 根因:deepin-anything-index 进程在 serviceentry.cpp 中注册了三个
   D-Bus 服务名(TextIndex、FileNameIndex、OcrIndex),但仅 TextIndex
   有 .service 激活文件;服务停止后 D-Bus 收到对另外两个服务名的调用
   时找不到激活文件,返回 ServiceUnknown,无法自动启动进程
2. 方案:在 assets/dbus/ 下新增 FileNameIndex.service 和 OcrIndex.service,
   Exec 和 SystemdService 与 TextIndex.service 一致;CMakeLists.txt
   安装规则一并安装三个文件
3. 影响:文件索引和图片文本内容索引在服务停止后可像全文索引一样自动
   激活服务;不影响现有 TextIndex 行为,不修改任何函数签名

Log: 文件索引和图片文本内容索引在服务停止后可自动激活索引服务

Influence:
1. 停止 deepin-anything-index.service 后点击"文件索引",验证服务被激活且索引更新成功
2. 停止服务后点击"图片文本内容索引",验证服务被激活且索引更新成功
3. 停止服务后点击"全文索引",验证无回归
4. 验证 dbus-1/services/ 目录下三个 .service 文件均已安装

PMS: BUG-TASK-395529
@Johnson-zs
Johnson-zs force-pushed the agent/bugfix/613a52e685a9 branch from 2021211 to b3ef4a0 Compare November 19, 2026 07:49
@Johnson-zs
Johnson-zs merged commit acbc2c8 into linuxdeepin:develop/snipe Nov 19, 2026
17 of 20 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.

2 participants