← Back to issue list

Unhandled error when organizing a file to a directory where the file already exists

View original Github issue

Metadata

Project
craft-parts
Number
#1366
Type
issue
State
closed
Author
upils
Labels
Status: Triaged Type: Bug
Created
Updated
Closed

Current evaluation

Abandoned without a public fix. The bug was tracked internally via Jira (CRAFT-4870) to address unhandled errors when organizing files to existing directories.

Suggested action:

No scores available.

Issue body

### Bug Description The `organize_files` function in craft-parts does not properly detect collisions when the destination is a directory. If an entry organize a file to a destination and then a second entry also tries to organize to the same destination but expressed as a directory, it fails because the call to `file_utils.move(src,dst)` fails. However this error is not handled and is "swallowed". The function should probably check if the destination exists when `overwrite` is `False` before calling `file_utils.move(src,dst)`. ### To Reproduce Running `python3 -mcraft_parts --trace -v prime` with this project file fails with `Error: None`. ### part yaml ```shell parts: rootfs: plugin: nil override-build: | mkdir $CRAFT_PART_INSTALL/foo mkdir $CRAFT_PART_INSTALL/bar echo "a from foo" > $CRAFT_PART_INSTALL/foo/a echo "a from bar" > $CRAFT_PART_INSTALL/bar/a organize: 'bar/a': /qux/a 'foo/a': /qux/ ``` ### Relevant log output ```shell INFO:craft_parts.executor.executor:Installing build-packages Execute: Pull rootfs Execute: Overlay rootfs Execute: Build rootfs + mkdir /home/paul/scratch/craft-parts/parts/rootfs/install/foo + mkdir /home/paul/scratch/craft-parts/parts/rootfs/install/bar + echo 'a from foo' + echo 'a from bar' Error: None. ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Abandoned without a public fix. The bug was tracked internally via Jira (CRAFT-4870) to address unhandled errors when organizing files to existing directories.
qwen/qwen3.6-35b-a3b Closed and triaged. Reports a silent failure in organize_files when organizing to an existing directory. Synced to Jira for tracking.
qwen/qwen3.6-35b-a3b Closed without resolution or linked fix. The unhandled collision error in organize_files when moving files to an existing directory was triaged but remains unresolved.
qwen3.6-35b-a3b-mtp-q6 Closed and tracked internally via Jira ticket CRAFT-4870. No public fix, merge, or resolution details were provided.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.