inconsistency in organize to overlay
Metadata
Current evaluation
Inconsistent directory organization to overlay partitions was fixed in commit 139cbce6 via PR #1602. The change normalizes overlay handling in organize_files() to ensure consistent nesting for glob keys across all destinations.
Suggested action: —
No scores available.
Issue body
### Bug Description
When organizing a directory to a directory, craft-parts exhibits two different behaviors: MERGE and NEST, depending on the presence of glob keys. If the source is a glob key and destination is the `(overlay)` pseudo-partition the behavior is different from all other glob key cases, as shown in the table below:
| Key type | Destination type | Behavior |
|------------------|-------------------|----------|
| Explicit (no *) | Any | MERGE |
| Glob (*) | Partition root | NEST |
| Glob (*) | Overlay partition | MERGE |
| Glob (*) | Regular path | NEST |
The inconsistency is at lines 199-202 of organize.py:
if dst_path in install_dir_map.values():
real_dst_path = dst_path / src_path.name
else:
real_dst_path = dst_path
The "else" branch handles the overlay partition case and sets
real_dst_path to dst_path directly, causing a MERGE instead of a NEST.
To make the overlay partition consistent with other destinations, the
fix would be to also nest the source directory name for the overlay
partition:
if dst_path in install_dir_map.values():
real_dst_path = dst_path / src_path.name
elif dst_partition_pair.partition == OVERLAY_PARTITION:
real_dst_path = dst_path / src_path.name
else:
real_dst_path = dst_path
This ensures that a glob key always nests, regardless of whether the
destination is a partition root, overlay partition, or regular path.
The only case that should MERGE is when the key is explicit (no *),
since the user is explicitly naming the source directory and
specifying where its contents should go.
[organize_behavior.txt](https://github.com/user-attachments/files/28116512/organize_behavior.txt)
### To Reproduce
Create a part that organizes from a glob key to a directory under `(overlay)/`.
### part yaml
```shell
```
### Relevant log output
```shell
N/A
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Inconsistent directory organization to overlay partitions was fixed in commit 139cbce6 via PR #1602. The change normalizes overlay handling in organize_files() to ensure consistent nesting for glob keys across all destinations. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
40
Confidence:
90
Support Request:
0
|
keep open | Bug report regarding inconsistent behavior when organizing directories to overlay partitions in craft-parts. Issue is triaged and assigned to a maintainer. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
55
Complexity:
15
Confidence:
95
Support Request:
0
|
keep open | Inconsistency in craft-parts organize behavior when glob keys target the overlay partition, causing MERGE instead of expected NEST. Triaged, awaiting fix implementation. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
45
Complexity:
30
Confidence:
90
Support Request:
0
|
keep open | Reports an inconsistency in craft-parts where glob-based directory organization to the overlay partition merges instead of nesting, unlike other destinations. Triaged, awaiting fix implementation. |
Update history
| Date | Change |
|---|---|
| closed |
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1596 fix(organize): nest overlay directory globs | craft-parts | closed | Superseded by pull request #1602. The overlay directory glob nesting fix was replaced by a subsequent implementation. | |
| #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. | |
| #1586 fix(organize): allow merging directories in overlay with metadata differences | craft-parts | merged | Merged. Resolves #1487 by permitting overlay directories with differing permissions or ownership to merge without raising FileOrganizeError. Review feedback was incorporated via automated commits, CI passed, and the change was successfully merged. | |
| #278 docs: add '(overlay)' to the `organize` key description | imagecraft | merged | Merged documentation update adding the overlay pseudo-partition mention to the organize key description. Approved by two reviewers and passed CI checks, clarifying a load-bearing rootfs copy feature. | |
| #1541 fix(organize): make organizing to the overlay idempotent | craft-parts | merged | Merged to fix overlay organization idempotency and resolve #1488. Copilot automatically resolved merge conflicts in commit 4282caa6, reverting BUILD_PARTITION while preserving OVERLAY_PARTITION logic. All tests pass. |