Overlay contents don't conflict with regular stage files
Metadata
Current evaluation
Conflicts between overlay and stage files across different parts were not detected, causing undefined behavior. Fixed and merged in pull request #1190 to the canonical/craft-parts repository.
Suggested action: —
No scores available.
Issue body
### Bug Description
Files coming from a part's `OVERLAY` step and another part's `STAGE` step don't seem to be checked for conflict. The result seems undefined; in some cases I get the overlay file, in other cases the stage one.
### To Reproduce
Have a part that places a file in `CRAFT_OVERLAY`, and another that places the same file, with different contents, in `CRAFT_PART_INSTALL`.
Here's some output with the example parts.yaml:
```
../project# cat ../parts/part1/install/should-conflict.txt
This comes from part1's BUILD
../project# cat ../parts/part2/layer/should-conflict.txt
This comes from part2's OVERLAY
../project# ls ../stage/
should-conflict.txt usr
../project# cat ../stage/should-conflict.txt
This comes from part1's BUILD
```
### part yaml
```shell
name: overlay-conflict
base: ubuntu@24.04 # the base environment for this rock
version: '0.1' # just for humans. Semantic versioning is recommended
summary: Single-line elevator pitch for your amazing rock # 79 char long summary
description: |
This is overlay-conflict's description. You have a paragraph or two to tell the
most important story about it. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the
container registries out there.
platforms: # the platforms this rock should be built on and run on
amd64:
parts:
part1:
plugin: nil
override-build: |
echo "This comes from part1's BUILD" >> $CRAFT_PART_INSTALL/should-conflict.txt
part2:
plugin: nil
overlay-script: |
echo "This comes from part2's OVERLAY" >> $CRAFT_OVERLAY/should-conflict.txt
```
### Relevant log output
```shell
2025-06-24 12:40:05.836 Staging part1
2025-06-24 12:40:05.836 execute action part1:Action(part_name='part1', step=Step.STAGE, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None))
2025-06-24 12:40:05.855 Staging part2
2025-06-24 12:40:05.856 execute action part2:Action(part_name='part2', step=Step.STAGE, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None))
2025-06-24 12:40:05.857 staging overlay files
2025-06-24 12:40:05.857 migrate None partition part 'part2' layer to stage
2025-06-24 12:40:05.857 check layer visibility in /root/parts/part2/layer
2025-06-24 12:40:05.857 check if path is visible: root=/root/stage, relpath=should-conflict.txt
2025-06-24 12:40:05.857 layer visibility files=set(), dirs=set()
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Conflicts between overlay and stage files across different parts were not detected, causing undefined behavior. Fixed and merged in pull request #1190 to the canonical/craft-parts repository. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed undefined behavior when overlay and stage files from different parts lacked conflict checks. Resolved by merging pull request #1190 in canonical/craft-parts. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed undefined behavior when overlay and stage steps from different parts placed identical files without conflict detection. Resolved and merged in pull request #1190. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Overlay and stage file conflicts across parts were not properly detected, causing undefined behavior. The bug was fixed and merged in pull request #1190 for the canonical/craft-parts repository. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1619 fix: migrate overlay files before running stage or prime (#1617) | craft-parts | merged | Merged cherry-pick of canonical/craft-parts#1617. Resolves changelog conflicts and migrates overlay files before stage or prime execution. Approved by two reviewers and merged following CI validation. | |
| #1190 fix(overlay): detect conflicts between overlay and install | craft-parts | merged | Merged fix enhancing Stage step collision detection to account for overlay contents, preventing conflicts with install directories. Includes integration tests, passed all CI checks, and received approval from three reviewers. |