Skip to content

fix(builder): propagate stat errors when cleaning build artifacts - #2125

Open
chennaji9 wants to merge 1 commit into
OpenAtom-Linyaps:masterfrom
chennaji9:fix/clean-artifacts-stat-error
Open

chennaji9 wants to merge 1 commit into
OpenAtom-Linyaps:masterfrom
chennaji9:fix/clean-artifacts-stat-error

Conversation

@chennaji9

Copy link
Copy Markdown

What does this PR do?

Builder::cleanBuildArtifacts() treated a failing stat query as "nothing to clean":

std::error_code ec;
if (!std::filesystem::exists(this->internalDir, ec)) {
    return LINGLONG_OK;
}

exists() also returns false when the query itself fails (error_code set — e.g. a parent directory lost search permission). The error is swallowed and the cleanup silently reports success without removing anything.

Check the query outcome first and propagate the error; the legitimate "directory absent" case still returns success.

Validation

  • Matches the error handling already used for the remove_all call later in the same function (filesystem error_code checked and wrapped with the path).
  • ll-tests builds cleanly with the change (the Builder class has no unit-test seam for constructing internalDir states, so this is validated by build + code path review).

🤖 Generated with Claude Code

@deepin-ci-robot

Copy link
Copy Markdown
Collaborator

Hi @chennaji9. Thanks for your PR.

I'm waiting for a OpenAtom-Linyaps member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...linglong/src/linglong/builder/linglong_builder.cpp 50.00% 1 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
...linglong/src/linglong/builder/linglong_builder.cpp 10.81% <50.00%> (+0.05%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

cleanBuildArtifacts() treated a failing exists() query (error_code set,
e.g. EACCES on a parent) as "directory absent" and returned success,
silently skipping the cleanup; check the error_code first and return an
error, keeping the legitimate not-exist case as success.

Signed-off-by: 陈那几 <2078634206@qq.com>
@chennaji9
chennaji9 force-pushed the fix/clean-artifacts-stat-error branch from dc8acd7 to 880b344 Compare October 13, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants