fix: handle trying to organize a file to itself
Metadata
Current evaluation
Merged PR #1201 in commit ae1de9f6, fixing #1007 by detecting identical source and destination paths and skipping shutil.move().
Resolution: closed resolved
Reason: PR #1201 was approved and merged as commit ae1de9f6. It prevents file organization errors caused by glob expansion resolving source and destination to the same file.
Evaluated by: mr-cal-bot
No scores available.
Issue body
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you added an entry to the changelog (`docs/reference/changelog.rst`)?
-----
When organizing files, glob expansion can lead to src and dst being the same file. Detect and skip it before calling `shutil.move()`.
Also refactor and add comments to `organize_files()`.
Fixes #1007
CRAFT-4138
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #1201 in commit ae1de9f6, fixing #1007 by detecting identical source and destination paths and skipping shutil.move(). | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #1201 (commit ae1de9f6) fixed #1007 by detecting identical glob-expanded source and destination paths and skipping shutil.move(). | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix for glob expansion causing file organization to move a file to itself. Added detection to skip identical paths before shutil.move. Includes refactor and comments for organize_files. Approved by three reviewers and passed all CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix preventing shutil.move errors when glob expansion matches source and destination paths. The change detects identical paths and skips the operation, while refactoring and documenting organize_files. Resolves #1007 and CRAFT-4138. |
Update history
No update history recorded yet.
Related work
-
Related To:
canonical/craft-parts#1007
(confidence 100%)
PR #1201 explicitly fixes the unhelpful organize error reported in issue #1007.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #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. |