fix: prevent organizing a directory into itself
Metadata
Current evaluation
PR #1544 was closed unmerged as incomplete; the solution was replaced by the organize-from-build rework in #1598 (commit cc02958b).
Resolution: closed superseded
Reason: The maintainer noted that uncovered cases remained and organize-from-build needed a new implementation. PR #1598 later merged that rework in commit cc02958b.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Only move a directory after checking if it's not being organized into
itself (or a subpath of itself).
- [ ] Have you followed the guidelines for contributing?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `make lint && make test`?
- [ ] Have you added an entry to the changelog (`docs/reference/changelog.rst`)?
---
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed superseded | PR #1544 was closed unmerged as incomplete; the solution was replaced by the organize-from-build rework in #1598 (commit cc02958b). | |
| stealth/space-bunny-alpha | — | closed superseded | Directory self-organization guard was closed as incomplete; organize-from-build was reworked in canonical/craft-parts#1598 (cc02958b). | |
| qwen/qwen3.6-35b-a3b | — | — | Preventing directory organization into itself was closed and superseded. The author noted the solution was incomplete and will be reworked with a new organize-from-build implementation. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Abandoned and closed. The maintainer noted the solution fails to cover all edge cases and will be reworked in a future implementation of organize-from-build. |
Update history
No update history recorded yet.
Related work
-
Superseded By:
canonical/craft-parts#1598
(confidence 99%)
Merged the replacement organize-from-build implementation in commit cc02958b.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1769 fix(organize): handle direct self-nesting as error | craft-parts | merged | Merged PR #1769 fixes #1460 by raising FileOrganizeError for direct self-nesting in the organize step, preventing broken builds. | |
| #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. | |
| #1562 fix(organize): reject sources outside install dir | craft-parts | merged | Merged PR #1562 as commit 32b95b4f, rejecting organize sources outside the install directory while preserving existing symlink behavior. | |
| #1370 fix: make sure the destination does not exist before organizing | craft-parts | merged | Merged PR #1370 as commit 7fe7c84e, removing any existing organize destination before moving files and fixing #1366/CRAFT-4870. | |
| #1548 fix: revert organize from build | craft-parts | merged | Merged in #1548 as 56282732, reverting #1535/8e4daf5 to remove organize from build after it caused a Snapcraft regression; downstream testing confirmed the fix. | |
| #1525 Directory traversal issue when organizing a part | craft-parts | closed | Fixed by merged PR #1562 (commit 32b95b4f), rejecting organize sources that escape the install directory via absolute paths or traversal. | |
| #690 fix(organize): use the part's install directories (#689) | craft-parts | merged | Merged PR #690 in commit 0eff7cc9 (change c349e740), fixing organize_files() to use part install directories and organize under base_dir. | |
| #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. | |
| #1592 Refactor and integrate organize from build | craft-parts | closed | Reintroduced organize-from-build in merged PR #1598 (commit cc02958b), with (build) as a source partition whose files are copied rather than moved. | |
| #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. |