Repository navigation
feat: integrate D-Bus event relay - #281
Conversation
Replace socket-based event dispatcher with a D-Bus service exporting org.deepin.Anything interface and a relay dispatcher that broadcasts raw fs_event structs to connected channels via a worker thread. 新增D-Bus服务接口org.deepin.Anything,提供SetAllowCaller和 GetEventChannel方法;新增事件中继分发器通过worker线程广播 原始fs_event;修复监听器GSource附加到错误GMainContext的问题; fs_event结构src/dst合并为path字段,minor类型扩展为guint32。 Log: 新增D-Bus服务及事件中继分发器,替换旧的socket分发方式 PMS: BUG-370779 Influence: server服务改为D-Bus方式提供事件通道,影响事件监听和分发的整体流程
Add trust negotiation with deepin-security-loader via fd passing, switch VfsMonitor to D-Bus GetEventChannel relay, enable systemd notify and journal logging. 添加与deepin-security-loader的信任协商,通过fd传递实现; VfsMonitor事件通道从Unix socket切换到D-Bus GetEventChannel 中继;启用systemd notify和journal日志重定向。 Log: 集成安全信任客户端与D-Bus事件中继 PMS: BUG-370779 Influence: 索引服务启动时需通过deepin-security-loader信任验证,事件接收改为D-Bus中继方式,安装路径迁移至libexec/deepin。
Replace isParentChainUnderRoot with mutual-containment check between mount points and rootPaths. Store root and isRootEqMountPoint in MountPointInfo so resolveAndFilterFullPath can strip the root prefix and prepend the correct mount point. Remove the overlay fallback hack and drop overlay from isLowerFsType. 重写挂载点解析逻辑:用挂载点与rootPaths的互相包含检查代替 isParentChainUnderRoot;在MountPointInfo中保存root字段,使路径解析 能正确剥离root前缀并拼接挂载点。移除overlay回退逻辑,不再将 overlay视为lowerfs。 Log: 修复VFS监控挂载点路径解析错误 PMS: BUG-370779 Influence: 修复挂载环境下文件监控路径解析不准确的问题,提升监控可靠性。
|
Sorry @wangrong1069, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 4 days and 6 hours by commenting |
|
Warning
详情 {
"unset": {
"autotests/index/test_vfsmonitorfilesystemwatcher.cpp": {
"a": [
" qunsetenv(\"DFM_VFSMONITOR_SOCKET_PATH\");",
" qunsetenv(\"DFM_VFSMONITOR_SOCKET_PATH\");",
" qunsetenv(\"DFM_VFSMONITOR_SOCKET_PATH\");",
" qunsetenv(\"DFM_VFSMONITOR_SOCKET_PATH\");",
" qunsetenv(\"DFM_VFSMONITOR_SOCKET_PATH\");",
" qunsetenv(\"DFM_VFSMONITOR_MAX_QUEUE\");"
]
}
},
"export": {
"src/server/dbus-service.h": {
"b": [
" * An opaque D-Bus service object that exports the org.deepin.Anything"
]
}
}
} |
Reviewer's GuideThe PR replaces the legacy Unix dispatcher socket with a system-bus D-Bus event-relay API: the server forwards raw filesystem events through worker-thread-managed channels and authorizes clients, while the index obtains a passed FD, decodes the new protocol, updates mount-aware filtering, negotiates security-loader trust, and gains journal logging. Build, packaging, service definitions, and tests are updated accordingly. Sequence diagram for authorized event-channel acquisitionsequenceDiagram
participant Index
participant Loader as SecurityLoader
participant Bus as SystemBus
participant Service as AnythingDBusService
participant Relay as RelayDispatcher
Index->>Loader: request_dbus_trust
Loader-->>Index: Result=true
Index->>Bus: GetEventChannel
Bus->>Service: handle_get_event_channel
Service->>Relay: server_event_relay_dispatcher_get_event_channel
Relay-->>Service: get_event_channel_callback(fd, protocol_id)
Service-->>Index: D-Bus reply with Unix FD and protocol_id
Index->>Index: recv fs_event and process filesystem event
Flow diagram for filesystem event deliveryflowchart TD
Event["Raw fs_event from netlink"] --> Queue["Relay event queue"]
Queue --> Worker["Relay worker thread"]
Worker --> Channel["Per-client SOCK_SEQPACKET channel"]
Channel --> Decode["Index recv and decode fs_event"]
Decode --> Resolve["resolveAndFilterFullPath"]
Resolve --> Batch["Queue and flush filtered events"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: ['vfsmonitorwatcher.cpp 中 constexpr size_t kPathLen = sizeof(fs_event().path) 使用临时对象获取成员大小,虽然合法但可读性不如直接使用 kDispatchMaxPathLen'] 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: ['可考虑将 startup 同步模式抽取为通用宏或辅助函数以减少重复'] 3. 代码性能 ✅评价: 良好 ✅ 通过 潜在问题: 建议: ['drainSocket 可考虑使用 recvmmsg 替代单次 recv 以恢复批量接收能力,或使用 MSG_WAITFORONE 批量读取', 'read_balanced_json 可使用缓冲区读取(如4096字节)替代逐字节读取'] 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: ['D-Bus 策略文件 org.deepin.Anything.conf 正确限制了服务所有权和 SetAllowCaller 方法访问', 'GetEventChannel 通过 allow_callers 白名单进行应用层鉴权,实现了纵深防御', 'trustclient.cpp 中 strtol 正确验证了 end 指针和值范围,防止了整数溢出', 'read_balanced_json 正确跟踪 JSON 字符串和转义状态,防止了括号误匹配', 'fd 传递通过 GUnixFDList 正确管理所有权,dup 后关闭原始 fd 防止泄漏'] 💡 改进建议代码示例// 暂无代码示例本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, wangrong1069 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/merge |
|
This pr cannot be merged! (status: unstable) |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
0634c8a
into
linuxdeepin:develop/snipe
Summary by Sourcery
Integrate filesystem event delivery through a secured D-Bus relay service and update the index and server components to use the new event-channel architecture.
New Features:
Bug Fixes:
Enhancements:
Build:
Deployment:
Tests: