fix: make sure the destination does not exist before organizing
Metadata
Current evaluation
Merged PR #1370 as commit 7fe7c84e, removing any existing organize destination before moving files and fixing #1366/CRAFT-4870.
Resolution: closed resolved
Reason: PR #1370 was approved, passed all reported CI checks, and merged as commit 7fe7c84e. The PR explicitly fixes issue #1366.
Evaluated by: mr-cal-bot
No scores available.
Issue body
- [x] Have you followed the guidelines for contributing?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] Have you successfully run `make lint && make test`?
- [x] Have you added an entry to the changelog (`docs/reference/changelog.rst`)?
---
Fixes #1366
CRAFT-4870
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #1370 as commit 7fe7c84e, removing any existing organize destination before moving files and fixing #1366/CRAFT-4870. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged in canonical/craft-parts#1370 (7fe7c84e), ensuring the destination does not exist before organizing. The fix closes #1366/CRAFT-4870 and passed all reported CI checks. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged a fix preventing destination conflicts during the organize step by ensuring the target path does not exist beforehand. Approved by two reviewers, passed all CI checks, and resolves #1366 and CRAFT-4870. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Fixes #1366 by ensuring the destination does not exist before organizing. Re-run concerns were resolved by confirming existing overwrite and cleanup logic is covered by integration tests. |
Update history
No update history recorded yet.
Related work
-
Related To:
canonical/craft-parts#1366
(confidence 100%)
This reported the existing-destination failure that PR #1370 resolved.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1366 Unhandled error when organizing a file to a directory where the file already exists | craft-parts | closed | Fixed by merged PR canonical/craft-parts#1370 (commit 7fe7c84e), which checks whether an organize destination exists before moving files. | |
| #1599709 organize feature deletes destination folder, is surprising | snapcraft (launchpad) | closed | Organize was changed to preserve existing destination files; the fix merged in snapcraft#780 as commit 8386479e7. | |
| #1007 Organize fails with an unhelpful error when attempting to overwrite a file | craft-parts | closed | Closed as stale without a direct fix; the organize-overwrite failure was later fixed by merged PR #1370 (commit 7fe7c84e), ensuring the destination does not exist before moving files. | |
| #1544 fix: prevent organizing a directory into itself | craft-parts | closed | PR #1544 was closed unmerged as incomplete; the solution was replaced by the organize-from-build rework in #1598 (commit cc02958b). | |
| #1541 fix(organize): make organizing to the overlay idempotent | craft-parts | merged | Merged as commit a1178308: organizing files into the overlay partition is now idempotent, so repeat organization no longer errors on existing destinations. Fixes #1488 (CRAFT-5043); conflicts resolved in merge commit 4282caa6. | |
| #1488 Organizing to the overlay directory is not idempotent | craft-parts | closed | Fixed by merged PR #1541 (commit a1178308), making organization into the overlay idempotent so rebuilds no longer fail on existing destination directories. | |
| #1201 fix: handle trying to organize a file to itself | craft-parts | merged | Merged PR #1201 in commit ae1de9f6, fixing #1007 by detecting identical source and destination paths and skipping shutil.move(). | |
| #780 Organize without removing files on target | snapcraft | merged | Merged in commit 8386479e7, making organize preserve existing files and directories in the target while addressing LP #1599709. | |
| #1526 Strange behaviour when organizing from an empty string | craft-parts | closed | Fixed by merged PR #1532 in commit 46eeb3e8, which handles empty-string organize paths as a no-op when source and destination resolve to the same directory. |