Repository navigation
Conversation
1. Root cause: getFileInfo() home-path early-return branch (introduced by security commit 2c782c4) skips m_bGetFileInfoError reset, leaving stale true from prior system-log DBus auth failure to pollute app-log parsing 2. Fix: add m_bGetFileInfoError = false before early return so the flag is cleared regardless of which path executes 3. Impact: only the home-path branch gets the reset; DBus error/success paths unchanged, no behavior change for system-log flow Influence: 1. Test app log display after canceling system-log auth dialog 2. Test switching between system logs and app logs repeatedly 3. Verify app logs display normally after DBus auth failure recovery fix: 修复getFileInfo的home路径提前返回分支未重置错误标志 1. 根因:getFileInfo() 的 home-path 提前返回分支(安全提交 2c782c4 引入) 未重置 m_bGetFileInfoError,导致系统日志 DBus 鉴权失败留下的过期 true 状态污染后续应用日志解析 2. 方案:在提前返回前新增 m_bGetFileInfoError = false,确保无论走哪条 分支都清除错误标志 3. 影响:仅 home-path 分支增加重置,DBus 错误/成功路径不变,系统日志 流程无行为变化 Influence: 1. 测试取消系统日志鉴权弹窗后查看应用日志是否正常显示 2. 测试系统日志与应用日志之间反复切换 3. 验证 DBus 鉴权失败恢复后应用日志显示正常 PMS: BUG-378513
|
Sorry @pengfeixx, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 9 hours and 32 minutes by commenting |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pengfeixx 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 |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis one-line fix resets the error flag on the home-path early return, preventing a previously cancelled system-log authentication from causing application-log parsing to abort and display blank content. Sequence diagram for clearing stale log access errorssequenceDiagram
participant User
participant LogApplicationParseThread
participant DLDBusHandler
participant UserLogAccess
User->>LogApplicationParseThread: parseByFile()
LogApplicationParseThread->>DLDBusHandler: getFileInfo(flag, unzip)
alt home-path application log
DLDBusHandler->>DLDBusHandler: m_bGetFileInfoError = false
DLDBusHandler->>UserLogAccess: getFileInfo(flag, unzip)
UserLogAccess-->>DLDBusHandler: file information
DLDBusHandler-->>LogApplicationParseThread: file information
LogApplicationParseThread-->>User: display application logs
else prior system-log authentication was cancelled
LogApplicationParseThread->>DLDBusHandler: isGetFileInfoError()
DLDBusHandler-->>LogApplicationParseThread: false
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: 无 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: 无 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: 无 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: 无 💡 改进建议代码示例// 当前修复已正确,无需额外修改
// application/dbusproxy/dldbushandler.cpp
QStringList DLDBusHandler::getFileInfo(const QString &flag, bool unzip)
{
// ...
// home 目录下日志由用户日志访问类本地列举
if (isHomePath(flag)) {
m_bGetFileInfoError = false; // 重置错误标志,防止上次调用的错误状态残留
return UserLogAccess::instance()->getFileInfo(flag, unzip);
}
// ...
}本报告由 AI 代码审查工具自动生成 |
Root Cause Analysis
DLDBusHandler::getFileInfo()has an early-return branch for home-path logs (isHomePath(flag)) that bypasses DBus and reads locally viaUserLogAccess. This branch was introduced by security commit2c782c4(BUG-376053) but did not reset them_bGetFileInfoErrorflag. When a user first cancels a system-log DBus auth dialog, the flag is set totrue; switching to app logs (home-path) leaves the staletrueuntouched, andLogApplicationParseThread::parseByFile()(logapplicationparsethread.cpp:153) unconditionally checksisGetFileInfoError(), mistaking the stale state for an auth failure and aborting — producing a blank view.Key evidence:
dldbushandler.cpp:255-256: home-path early-return directly returns without resettingm_bGetFileInfoErrorlogapplicationparsethread.cpp:153:parseByFile()checksisGetFileInfoError()unconditionally, regardless of log path typelogapplicationhelper.cpp: app log default path is~/.cache/deepin/<appname>, which triggers the home-path branchFix Approach
Add
m_bGetFileInfoError = false;before the early return in the home-path branch ofgetFileInfo(), ensuring the error flag is cleared regardless of which code path executes. This is consistent with the DBus success branch (line 266) that already resets the flag. The fix is a single-line addition with no logic changes to existing paths.Change Safety Assessment
Code Safety
2c782c4(BUG-376053); this fix supplements the flag reset that was missed in that commit without reverting or altering the security hardeningLogApplicationParseThread::parseByFile()benefits directly — staletrueno longer causes false abort; no other callers are affectedgetFileInfo()'s home-path branch orm_bGetFileInfoErrorBusiness Impact Scope
~/.cache/deepin/) will now always display correctly regardless of prior system-log auth stateVerification Suggestion
根因分析
DLDBusHandler::getFileInfo()的 home-path early-return 分支(isHomePath(flag))绕过 DBus 直接通过UserLogAccess本地读取日志。该分支由安全提交2c782c4(BUG-376053)引入,但未重置m_bGetFileInfoError标志。当用户先取消系统日志 DBus 鉴权弹窗时,标志被置为true;切换到应用日志(home-path)时,过期的true状态未被清除,LogApplicationParseThread::parseByFile()(logapplicationparsethread.cpp:153)无条件检查isGetFileInfoError(),误判为鉴权失败并中止,导致应用日志显示空白。关键证据:
dldbushandler.cpp:255-256:home-path early-return 直接返回,不重置m_bGetFileInfoErrorlogapplicationparsethread.cpp:153:parseByFile()无条件检查isGetFileInfoError(),不区分日志路径类型logapplicationhelper.cpp:应用日志默认路径为~/.cache/deepin/<appname>,走 home-path 分支修复方案
在
getFileInfo()的 home-path early-return 分支的return之前新增m_bGetFileInfoError = false;,确保无论走哪条路径都清除错误标志。与 DBus 成功分支(266 行)已有重置逻辑保持一致。仅新增 1 行,不修改任何现有路径逻辑。改动安全评估
代码安全评估
2c782c4(BUG-376053)引入;本修复仅补充遗漏的标志重置,不撤销或修改安全加固逻辑LogApplicationParseThread::parseByFile()直接受益——过期的true不再导致误中止;无其他调用方受影响getFileInfo()的 home-path 分支或m_bGetFileInfoError业务影响范围
~/.cache/deepin/下)不再受先前系统日志鉴权状态影响,始终正常显示验证建议
Summary by Sourcery
Bug Fixes: