Repository navigation
Conversation
1. Root cause: path.replace(QRegularExpression("[1-9]$"), "0")
blindly zeroed the last digit of SysFS paths, corrupting both
USB device port numbers and interface numbers
2. Fix: remove the normalization line so SysFS paths retain their
original values for authorized file access
3. Impact: multi-interface USB devices no longer have their authorized
paths overwritten; single-interface behavior unchanged
Log: fix USB device authorized path corruption from path normalization
Influence:
1. Test disabling USB devices with multi-interface configurations
2. Verify authorized file paths match actual SysFS paths
3. Test enabling/disabling single-interface USB devices for regression
fix: 移除 disableOutDevice 中错误的路径归一化
1. 根因:path.replace(QRegularExpression("[1-9]$"), "0") 粗暴地将
SysFS 路径末位数字归零,同时破坏了设备端口号和接口号
2. 方案:移除归一化行,使 SysFS 路径保持原值用于 authorized
文件访问
3. 影响:多接口 USB 设备不再出现 authorized 路径相互覆盖;
单接口设备行为不变
Log: 修复 USB 设备 authorized 路径因归一化导致被覆盖的问题
Influence:
1. 测试多接口 USB 设备的禁用功能
2. 验证 authorized 文件路径与实际 SysFS 路径一致
3. 测试单接口 USB 设备的启用/禁用以检查回归
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos 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 GuideRemoves incorrect SysFS path normalization from USB device disabling so multi-interface devices retain distinct, actual authorized paths while single-interface behavior remains unchanged. Sequence diagram for preserving USB SysFS authorized pathssequenceDiagram
participant Caller
participant EnableUtils
participant SysFS
Caller->>EnableUtils: disableOutDevice(info)
EnableUtils->>EnableUtils: mapItem["SysFS ID"]
EnableUtils->>SysFS: access original SysFS path
SysFS-->>EnableUtils: authorized file for exact device/interface path
EnableUtils-->>Caller: device disabled
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个安全漏洞 ✅ 通过
安全漏洞详情: 建议: 无 💡 改进建议代码示例// 当前代码已正确:移除错误的路径规范化后,path 保持原始 SysFS ID 值
// 无需额外修复,删除 path.replace(QRegularExpression("[1-9]$"), "0") 即为正确做法
// disableOutDevice 函数中路径获取逻辑(修改后):
// if (mapItem.contains("Path")) {
// path = mapItem["Path"];
// } else {
// path = mapItem["SysFS ID"];
// }
// // 路径直接使用,不做错误的末尾数字替换
// QRegularExpression reg(REG_ADDRESS);本报告由 AI 代码审查工具自动生成 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: remove incorrect SysFS path normalization
blindly zeroed the last digit of SysFS paths, corrupting both
USB device port numbers and interface numbers
original values for authorized file access
paths overwritten; single-interface behavior unchanged
Log: fix USB device authorized path corruption from path normalization
Influence:
fix: 移除 disableOutDevice 中错误的路径归一化
SysFS 路径末位数字归零,同时破坏了设备端口号和接口号
文件访问
单接口设备行为不变
Log: 修复 USB 设备 authorized 路径因归一化导致被覆盖的问题
Influence:
Summary by Sourcery
Bug Fixes: