Organizing to the overlay directory is not idempotent
Metadata
Current evaluation
Fixed by merged PR #1541 (commit a1178308), making organization into the overlay idempotent so rebuilds no longer fail on existing destination directories.
Resolution: closed resolved
Reason: PR #1541 was merged as commit a1178308, changing overlay organization to tolerate already-existing destinations during rebuilds.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
This may have the same root cause as #1487.
Parts that organize to the overlay cannot be re-built without erroring when trying to organize them.
### To Reproduce
1. Copy the part YAML below to `parts.yaml`
2. `mkdir /tmp/empty`
3. `sudo $(which python) -m craft_parts --verbose --overlay-base=/tmp/empty --partitions=default,other build`
4. Uncomment the line to create subdir-b
5. `sudo $(which python) -m craft_parts --verbose --overlay-base=/tmp/empty --partitions=default,other build`
### part yaml
```shell
parts:
part-a:
plugin: nil
override-build: |
mkdir -p $CRAFT_PART_INSTALL/my-dir/subdir-a
# mkdir -p $CRAFT_PART_INSTALL/my-dir/subdir-b
organize:
'*': (overlay)/
```
### Relevant log output
```shell
INFO:craft_parts.executor.executor:Installing build-packages
Execute: Rebuild part-a ('override-build' property changed)
unknown argument ignored: lazytime
+ mkdir -p /home/lengau/Work/Code/craft-parts/parts/part-a/install/my-dir/subdir-a
Error: Failed to organize part 'part-a': trying to organize '*' to '(overlay)/', but '(overlay)/my-dir' already exists.
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #1541 (commit a1178308), making organization into the overlay idempotent so rebuilds no longer fail on existing destination directories. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #1541 (commit a1178308), making overlay organization idempotent so rebuilds no longer fail when destination directories already exist. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. The overlay organization bug was triaged and assigned for investigation, but no fix was merged. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed and deferred to Jira ticket CRAFT-5043 for investigation and test creation. No fix or merge implemented. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without a fix. Transferred to internal Jira ticket CRAFT-5043. Assigned to a developer for test creation, but no pull request or resolution was merged. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed after assignment to author a reproducing integration test. The overlay organization idempotency bug was abandoned, with no fix implemented. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/craft-parts#1541
(confidence 100%)
The merged PR and commit explicitly fix overlay organization idempotency.
-
Related To:
canonical/craft-parts#1487
(confidence 95%)
The issue description identified a possibly shared root cause, but the problems were resolved separately.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1541 fix(organize): make organizing to the overlay idempotent | craft-parts | merged | Merged as commit a1178308: organizing files into the overlay partition is now idempotent, so repeat organization no longer errors on existing destinations. Fixes #1488 (CRAFT-5043); conflicts resolved in merge commit 4282caa6. | |
| #1586 fix(organize): allow merging directories in overlay with metadata differences | craft-parts | merged | Merged as 0797420f, closing #1487. Final review changes tightened overlay directory conflict handling and retained strict errors for metadata mismatches. | |
| #1544 fix: prevent organizing a directory into itself | craft-parts | closed | PR #1544 was closed unmerged as incomplete; the solution was replaced by the organize-from-build rework in #1598 (commit cc02958b). | |
| #1618 fix: handle dependencies when organizing to overlay | craft-parts | merged | Merged PR #1618 (commit 18239b07) fixes dependency scheduling when organizing to overlay, prioritizing BUILD/organize over dependency STAGE steps and closing #1611. | |
| #1596 fix(organize): nest overlay directory globs | craft-parts | closed | Overlay directory-glob fix was superseded by merged PR #1602 (commit 139cbce6), which restored consistent nesting for glob keys while explicit keys merge. | |
| #1487 Multiple parts cannot organize to the same directory in the overlay | craft-parts | closed | Fixed by merged PR canonical/craft-parts#1586 (commit 0797420f), allowing wildcard-organized overlay directories from multiple parts to merge despite metadata differences. | |
| #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. | |
| #1602 fix(organize): make organize to overlay behavior consistent | craft-parts | merged | Merged as 139cbce6, fixing a regression from #1541: glob-key overlay organization now nests files, while explicit keys continue to merge them. |