fix: improve symlink handling in filename search#303
Conversation
1. Added test cases for symlink directory handling in real-time search 2. Modified real-time strategy to skip recursing into symlink directories while still matching their names 3. Handles three key scenarios: symlink name matching, preventing recursion into symlinks, and avoiding cycles from circular symlinks 4. Tests verify correct behavior for each scenario Log: Improved symlink directory handling in file search Influence: 1. Test searching for files in directories containing symlinks 2. Verify symlink directory names are matched correctly 3. Confirm search doesn't follow symlinks into other directories 4. Check circular symlink detection and handling 5. Test search performance with multiple symlinks fix: 改进文件名搜索中的符号链接处理 1. 为实时搜索中的符号链接目录处理添加测试用例 2. 修改实时策略跳过递归进入符号链接目录,同时仍可匹配其名称 3. 处理三种关键场景:符号链接名称匹配、防止递归进入符号链接、避免环形符 号链接导致的循环 4. 测试验证了每种场景的正确行为 Log: 改进文件搜索中的符号链接目录处理 Influence: 1. 测试包含符号链接目录中的文件搜索 2. 验证符号链接目录名称能被正确匹配 3. 确认搜索不会跟随符号链接进入其他目录 4. 检查环形符号链接的检测和处理 5. 测试多符号链接情况下的搜索性能
There was a problem hiding this comment.
Sorry @Johnson-zs, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 示例:在现有修改基础上增加对文件系统状态突变的防御性检查
void FileNameRealTimeStrategy::search(const SearchQuery &query)
{
// ...
while (!directoryStack.isEmpty()) {
const QString currentDir = directoryStack.pop();
QDir dir(currentDir);
// 防御性检查:处理遍历过程中目录被删除或权限变更的竞态情况
if (!dir.exists()) {
qCWarning(logDFMSearch) << "Directory vanished during traversal:" << currentDir;
continue;
}
const QFileInfoList entries = dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
for (const QFileInfo &info : entries) {
// ... 执行文件名匹配逻辑 ...
// 符号链接目录不递归进入(防止循环),但其名称仍参与匹配
if (info.isDir() && !info.isSymLink()) {
directoryStack.push(info.filePath());
}
}
}
} |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
directories while still matching their names
recursion into symlinks, and avoiding cycles from circular symlinks
Log: Improved symlink directory handling in file search
Influence:
fix: 改进文件名搜索中的符号链接处理
号链接导致的循环
Log: 改进文件搜索中的符号链接目录处理
Influence: