feat: export deepin-elf-verify paths for base and runtime packages#1685
feat: export deepin-elf-verify paths for base and runtime packages#1685dengbo11 wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengbo11 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 |
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to selectively export specific paths (specifically 'share/deepin-elf-verify') for 'base' and 'runtime' package kinds during updates, rather than exporting all entries. It adds the 'exportReferencePaths' method to 'OSTreeRepo' and updates 'exportEntries' to support an optional path filter, along with comprehensive unit tests. Feedback on the changes includes addressing a potential crash by checking if 'modules' is empty before accessing its front element, handling errors from 'getPackageInfo()', and adding the 'override' specifier to the overridden 'exportReferencePaths' method in the test mock.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
56c501c to
67dd6f5
Compare
Codecov Report❌ Patch coverage is
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
pre-commit.ci autofix |
af3800c to
32ab683
Compare
32ab683 to
c9f8683
Compare
1. Add exportReferencePaths method to OSTreeRepo for exporting specific paths only 2. Add optional exportPathsFilter parameter to exportEntries for filtered exports 3. Export share/deepin-elf-verify directory from base and runtime packages during updates 4. Namespace deepin-elf-verify exports by commit hash to avoid conflicts between versions 5. Update exportAllEntries to also export deepin-elf-verify for base and runtime kinds 6. Bump LINGLONG_EXPORT_VERSION from 1.0.0.2 to 1.0.0.3 7. Add comprehensive tests for filtered export functionality and package update scenarios Influence: 1. Test updating a base package and verify share/deepin-elf-verify is exported to entries directory 2. Test updating a runtime package and verify share/deepin-elf-verify is exported 3. Verify that multiple base/runtime versions export deepin-elf-verify under separate commit-named subdirectories 4. Test app-only updates and confirm exportReferencePaths is not called 5. Verify that non-existent filtered paths are skipped gracefully without errors 6. Test exportAllEntries exports deepin-elf-verify for both app and base/runtime packages 7. Verify that existing app entries (desktop files, icons, etc.) are still exported correctly alongside the new filtered paths 8. Test that ELF verification data remains accessible after package upgrades
c9f8683 to
bf3af19
Compare
deepin pr auto review★ 总体评分:40分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 文件: libs/linglong/src/linglong/repo/ostree_repo.cpp (第 2068-2099 行附近)
// 如果指定了导出路径过滤器,仅导出指定的路径
if (exportPathsFilter.has_value()) {
for (const auto &path : *exportPathsFilter) {
auto normalizedPath = std::filesystem::path(path).lexically_normal();
if (normalizedPath.is_absolute()) {
return LINGLONG_ERR(fmt::format(
"Failed to export {}: absolute path is not allowed in export filter: {}",
path));
}
// 防范路径遍历攻击:确保路径不包含 ".." 分量
for (const auto &component : normalizedPath) {
if (component == "..") {
return LINGLONG_ERR(fmt::format(
"Failed to export {}: path traversal (..) is not allowed in export filter: {}",
path));
}
}
auto source = appEntriesDir / normalizedPath;
auto destination = rootEntriesDir / normalizedPath;
if (normalizedPath == "share/deepin-elf-verify") {
destination = rootEntriesDir / "share/deepin-elf-verify" / item.commit;
}
exists = std::filesystem::exists(source, ec);
if (ec) {
return LINGLONG_ERR(fmt::format("Failed to check file existence: {}", source), ec);
}
if (!exists) {
continue;
}
auto ret = this->exportDir(item.info.id, source, destination, 10);
if (!ret.has_value()) {
return ret;
}
}
return LINGLONG_OK;
} |
|
@dengbo11: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Influence: