← Back to issue list

fix: handle trying to organize a file to itself

View original Github issue

Metadata

Project
craft-parts
Number
#1201
Type
pull request
State
merged
Author
upils
Labels
Created
Updated
Closed

Current evaluation

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.

Suggested action:

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
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 issues

Issue Project State Summary Similarity
#1260 fix: allow organize to move special files craft-parts merged Merged a fix enabling file organization to handle character and block devices. Replaced standard shutil.move with a custom helper supporting device nodes. Approved by three reviewers and passed all CI checks.
77%
#1602 fix(organize): make organize to overlay behavior consistent craft-parts merged Merged fix correcting glob-key organize behavior to overlay. Glob keys previously merged contents instead of nesting. Update restores expected nesting for consistency. Approved by three reviewers and passed CI checks.
75%
#784 Support globbing for organize snapcraft merged Merged after reviewer approval. Adds globbing support for the organize command, resolving LP: #1616459. Changes include 65 additions and 16 deletions across two files, with minor notes on empty parent directories deferred.
73%
#689 fix(organize): use the part's install directories craft-parts merged Merged fix for organize_files() which incorrectly used relative paths, organizing files in cwd instead of base_dir. The function now accepts the part's install directories directly. Approved by two reviewers and passed CI.
72%