Repository navigation
Conversation
1. Root cause: path.replace(QRegularExpression("[1-9]$"), "0")
blindly normalized the last digit of SysFS ID/Device Link to 0,
collapsing multi-interface USB device paths (e.g. 1-2.3 → 1-2.0)
and causing authorized file paths to overwrite each other
2. Fix: remove the incorrect normalization line so each interface
keeps its original SysFS path for authorized file operations
3. Impact: multi-interface USB devices are no longer treated as the
same path; disableOutDevice writes to the correct authorized file
per interface
Influence:
1. Test disabling a multi-interface USB device and verify each
interface gets its own authorized file
2. Test disabling a single-interface USB device for no regression
3. Verify network card disable path still works via ioctl
fix: 移除错误的 SysFS 路径归一化
1. 根因:path.replace(QRegularExpression("[1-9]$"), "0") 盲目将
SysFS ID/Device Link 末位数字归零,导致多接口 USB 设备路径被
折叠(如 1-2.3 → 1-2.0),authorized 文件路径相互覆盖
2. 方案:移除该错误归一化行,使每个接口保留原始 SysFS 路径进行
authorized 文件操作
3. 影响:多接口 USB 设备不再被视为同一路径,disableOutDevice
按接口写入正确的 authorized 文件
Influence:
1. 测试禁用多接口 USB 设备,验证每个接口写入独立 authorized 文件
2. 测试禁用单接口 USB 设备,验证无回归
3. 验证网卡禁用路径仍通过 ioctl 正常工作
|
[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 in Sequence diagram for per-interface USB device disablingsequenceDiagram
participant Caller
participant EnableUtils
participant SysFS
Caller->>EnableUtils: disableOutDevice(info)
EnableUtils->>EnableUtils: Read SysFS ID or Device Link
EnableUtils->>SysFS: Write authorized file for original interface path
SysFS-->>EnableUtils: Interface disabled
Flow diagram for USB and network device disablingflowchart TD
A["disableOutDevice(info)"] --> B{Network device?}
B -->|Yes| C[ioctl]
B -->|No| D[Use original SysFS path]
D --> E[Write interface authorized file]
E --> F[Disable USB interface]
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 变量从 mapItem["SysFS ID"] 获取后直接使用,不做错误归一化: // // void EnableUtils::disableOutDevice(const QString &info) // { // ... // } else { // path = mapItem["SysFS ID"]; // } // // // 网卡采用ioctl的方式禁用 // 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 normalized the last digit of SysFS ID/Device Link to 0,
collapsing multi-interface USB device paths (e.g. 1-2.3 → 1-2.0)
and causing authorized file paths to overwrite each other
keeps its original SysFS path for authorized file operations
same path; disableOutDevice writes to the correct authorized file
per interface
Influence:
interface gets its own authorized file
fix: 移除错误的 SysFS 路径归一化
SysFS ID/Device Link 末位数字归零,导致多接口 USB 设备路径被
折叠(如 1-2.3 → 1-2.0),authorized 文件路径相互覆盖
authorized 文件操作
按接口写入正确的 authorized 文件
Influence:
Summary by Sourcery
Bug Fixes: