← Back to issue list

Executor clean may not be 100% effective

View original Github issue

Metadata

Project
craft-parts
Number
#329
Type
issue
State
closed
Author
facundobatista
Labels
—
Created
Updated
Closed

Current evaluation

Fixed by merged PR canonical/craft-parts#345 ("executor: fix directory cleaning", commit b0086bbe), which replaced the suppress(FileNotFoundError) block with per-directory existence checks so all lifecycle dirs are removed.

Resolution: closed resolved

Reason: PR #345 was merged as commit b0086bbe and closed the issue; executor.py now guards each rmtree with its own exists() check instead of a single suppression block, so a missing prime/stage/parts dir no longer skips the rest of the cleanup.

Evaluated by: mr-cal-bot

No scores available.

Issue body

in `executor/executor.py`, `Executor.clean` has this code: ``` with contextlib.suppress(FileNotFoundError): shutil.rmtree(self._project_info.prime_dir) if initial_step <= Step.STAGE: shutil.rmtree(self._project_info.stage_dir) if initial_step <= Step.PULL: shutil.rmtree(self._project_info.parts_dir) ``` Three `rmtree` surrounded by the `supress` context manager. If the first `rmtree` fails with `FileNotFoundError` the exception will be suppressed, but the other two `rmtree` will NOT be run. It's worth to check if this pattern is repeated elsewhere.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed by merged PR canonical/craft-parts#345 ("executor: fix directory cleaning", commit b0086bbe), which replaced the suppress(FileNotFoundError) block with per-directory existence checks so all lifecycle dirs are removed.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR canonical/craft-parts#345 (commit b0086bbe), correcting executor cleanup when an earlier directory is missing.
qwen/qwen3.6-35b-a3b — — Identified a bug where Executor.clean skips subsequent directory removals if the first raises FileNotFoundError. The issue was closed without a direct fix or follow-up pull request, likely abandoned or resolved in a later refactor.
qwen/qwen3.6-35b-a3b — — Closed without discussion; likely abandoned or resolved in a later commit. The report identified that suppressing FileNotFoundError around multiple shutil.rmtree calls skips subsequent cleanup steps if the first fails.
qwen/qwen3.6-35b-a3b — — Abandoned. The contextlib.suppress wrapper in Executor.clean skips subsequent directory deletions if the first raises FileNotFoundError, leaving the cleanup bug unfixed.
qwen3.6-35b-a3b-mtp-q6 — — Reported a bug where contextlib.suppress around multiple shutil.rmtree calls skips subsequent deletions if the first raises FileNotFoundError. Closed without comments or linked PR, likely abandoned.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/craft-parts#345 (confidence 95%)

    Merged PR titled 'executor: fix directory cleaning' (commit b0086bbe) reworked Executor.clean cleanup logic.

Related issues

Issue Project State Summary Similarity
#345 executor: fix directory cleaning craft-parts merged Merged PR #345 fixed executor cleanup logic in commit b0086bbe, preventing lifecycle directories from unexpectedly remaining and resolving #329.
75%