← Back to issue list

`organize` with mapping like `{app: app/app}` when `app` is a directory not working as expected.

View original Github issue

Metadata

Project
craft-parts
Number
#1460
Type
issue
State
open
Author
javierdelapuente
Labels
Status: Triaged
Created
Updated
Closed
—

Current evaluation

Bug in `organize` mapping where moving a directory into itself (`app: app/app`) causes silent file deletion or crashes. A fix is being prepared and approved by maintainers.

Suggested action: keep open

Reason: The issue is triaged and a fix is actively being prepared by @NunesErick, who identified the root cause (destination inside source causes silent deletion or crashes). The proposed solution to reject self-nesting with `FileOrganizeError` was explicitly approved by @lengau, confirming the path forward.

Evaluated by: mr-cal-bot

Impact: 75 Quick Win: 35 Complexity: 45 Confidence: 90 Actionability: 85

Issue body

### Bug Description When a part with `organize` contains in the a mapping like `{"app": "app/app"} and the source "app" is a directory, the source is not organized to the desired directory. In other organize cases, like `{"app": "app2/app"}`, it works correctly as expected. Related to: https://github.com/canonical/rockcraft/issues/892 Looks related to this line: https://github.com/canonical/craft-parts/blob/b654a77fd4e41ddc8d520bda039e5c38560fc42c/craft_parts/executor/organize.py#L85 ### To Reproduce Using this `rorkcraft.yaml` file: ``` name: example base: ubuntu@24.04 version: '0.1' summary: Summary description: | Description platforms: amd64: parts: simpla-part: plugin: dump source: . organize: app: app/app stage: - app/app ``` and commands: ``` mkdir app touch app/file.txt ``` `rockcraft pack` fails with (when executing the `stage`, as `app/app` does not exist): ``` ubuntu@worklaptop:~/example$ rockcraft pack /root/parts/simpla-part/install/app: No such file or directory Detailed information: FileNotFoundError: filename: '/root/parts/simpla-part/install/app' ``` I would expect the correct output structure is generated in this case. ### part yaml ```shell fastapi-framework/install-app: plugin: dump source: . organize: app: app/app stage: - app/app ``` ### Relevant log output ```shell - ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b
Impact: 75
Quick Win: 35
Complexity: 45
Confidence: 90
Actionability: 85
keep open Bug in `organize` mapping where moving a directory into itself (`app: app/app`) causes silent file deletion or crashes. A fix is being prepared and approved by maintainers.
~deepseek/deepseek-pro-latest
Impact: 60
Quick Win: 26
Complexity: 50
Confidence: 85
Actionability: 85
keep open Organize mapping {app: app/app} for a directory fails because the destination is inside the source; glob workaround also breaks when app/app already exists. Triaged, fix in progress.
stealth/space-bunny-alpha
Impact: 62
Quick Win: 18
Complexity: 64
Confidence: 90
Actionability: 82
keep open Open, triaged bug: organize mapping app: app/app fails for a directory, and the app/* workaround breaks when app/app already exists; a robust fix is still needed.
qwen/qwen3.6-35b-a3b
Impact: 40
Quick Win: 14
Complexity: 50
Confidence: 75
Actionability: 70
keep open organize mapping {app: app/app} fails when app is a directory; triaged but unfixed for 216 days.
qwen/qwen3.6-35b-a3b
Impact: 65
Quick Win: 23
Staleness: 65
Complexity: 65
Confidence: 75
Support Request: 15
keep open organize mapping {app: app/app} fails when app is a directory; triaged but unfixed for 209 days. Workaround has edge cases.
qwen/qwen3.6-35b-a3b
Impact: 55
Quick Win: 19
Staleness: 40
Complexity: 65
Confidence: 75
Support Request: 15
keep open organize mapping {app: app/app} fails when app is a directory: link_or_copy_tree copies into app/app but shutil.rmtree(src) then deletes it. Workaround suggested but has edge cases.
qwen/qwen3.8-27b
Impact: 50
Quick Win: 20
Staleness: 10
Complexity: 60
Confidence: 80
Support Request: 5
keep open organize mapping {app: app/app} fails when app is a directory: link_or_copy_tree copies into app/app but shutil.rmtree(src) then deletes it. Maintainer suggested glob workaround {app/*: app/app/} 10 days ago; awaiting validation or proper fix.
qwen/qwen3.6-35b-a3b
Staleness: 25
Complexity: 45
Confidence: 85
Support Request: 10
keep open Bug in craft-parts organize step where mapping a directory to a subdirectory of itself fails. Recently commented on with a suggested workaround, awaiting validation or fix.
qwen/qwen3.6-35b-a3b
Staleness: 10
Complexity: 40
Confidence: 85
Support Request: 5
keep open Bug in organize mapping where moving a directory to a subdirectory of itself fails. Reproducible with clear steps. Maintainer suggested a workaround but the underlying bug remains open.
qwen/qwen3.6-35b-a3b
Staleness: 40
Complexity: 25
Confidence: 90
Support Request: 10
needs triage Bug in craft-parts organize step fails when mapping a directory to a subdirectory of itself. Reported with reproduction steps and a related issue. Currently awaiting maintainer review; a workaround was suggested.
qwen/qwen3.6-35b-a3b
Staleness: 55
Complexity: 30
Confidence: 90
Support Request: 10
needs triage Bug in craft-parts organize step where mapping a directory to a subdirectory path like app: app/app fails to create the target directory, causing rockcraft pack to error. Currently unlabelled and awaiting maintainer review.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 35
Confidence: 85
Support Request: 5
needs triage Bug in craft-parts organize step where mapping a directory to a nested path (e.g., app: app/app) fails during staging. Currently untriaged and awaiting maintainer review.

Update history

Date Change
updated
updated
updated
updated
updated
updated
updated
updated
updated

Related issues

No related issues found above the similarity threshold.