`organize` with mapping like `{app: app/app}` when `app` is a directory not working as expected.
Metadata
Current evaluation
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.
Suggested action: keep open
Reason: This is a valid bug in craft-parts where `organize` fails when moving a directory into a subdirectory of itself (e.g., {app: app/app}). A maintainer (@cmatsuoka) acknowledged the issue 10 days ago and suggested a glob workaround, but explicitly noted it has problematic edge cases. The issue has recent activity (contributor follow-up 0 days ago) and is related to rockcraft#892.
Impact:
55
Quick Win:
19.25
Staleness:
40
Complexity:
65
Confidence:
75
Support Request:
15
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:
55
Quick Win:
19.25
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.0
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. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
65
Complexity:
30
Confidence:
90
Support Request:
5
|
needs triage | Bug in the organize step where mapping a source directory to a subdirectory path fails during staging, triggering a FileNotFoundError. Issue remains open and awaiting triage. |
Update history
| Date | Change |
|---|---|
| updated | |
| updated | |
| updated | |
| updated |
Related work
-
Related To:
rockcraft#892
(confidence 95%)
Same bug reported from rockcraft side; explicitly referenced in this issue body as related.
Related issues
No related issues found above the similarity threshold.