← Back to issue list

craft-parts doesn't track primed files when using `override-prime`

View original Github issue

Metadata

Project
craft-parts
Number
#1122
Type
issue
State
open
Author
mr-cal
Labels
Created
Updated
Closed

Current evaluation

craft-parts writes an empty fileset to prime state when a part uses override-prime, since the scriptlet path in _run_step returns no tracked contents. Bug confirmed still present in current code; unlabelled, no comments; downstream snapcraft issue still open.

Suggested action: needs triage

Reason: The issue has no labels, no comments, and no assignee, so it shows no sign of being categorised or prioritised despite being filed by a maintainer 447 days ago. I verified the bug is still present in HEAD: _run_step in craft_parts/executor/part_handler.py returns StepContents(stage=step_info.step == Step.STAGE) for scriptlet runs, so override-prime yields empty files/dirs in PrimeState. It should be triaged and prioritised because downstream snapcraft#5552 is still open and explicitly blocked on this.

Impact: 45 Quick Win: 24.75 Staleness: 80 Complexity: 45 Confidence: 85 Support Request: 0

Issue body

### Bug Description When using `override-prime`, craft-parts doesn't track what files are primed. This is because craft-parts returns an empty fileset when using an `override-` script: https://github.com/canonical/craft-parts/blob/53f7d3602e6b083bb6a96e2eae1205861cff7e6d/craft_parts/executor/part_handler.py#L535 This causes downstream issues: - https://github.com/canonical/snapcraft/issues/4547 - https://github.com/canonical/snapcraft/issues/5552 ### To Reproduce ```python import pathlib import logging import yaml import craft_parts from craft_parts import LifecycleManager, Step # logging.basicConfig(level=logging.DEBUG) parts_yaml = { "no override-prime": { "parts": { "hello": { "plugin": "nil", "override-build": "touch $CRAFT_PART_INSTALL/hello.txt\ncraftctl default", }, }, }, "override-prime": { "parts": { "hello": { "plugin": "nil", "override-build": "touch $CRAFT_PART_INSTALL/hello.txt\ncraftctl default", "override-prime": "craftctl default", }, }, }, } for name, parts in parts_yaml.items(): lcm = LifecycleManager( parts, application_name="example", cache_dir=".", ) lcm.clean() actions = lcm.plan(Step.PRIME) with lcm.action_executor() as aex: aex.execute(actions) prime_state = pathlib.Path("parts/hello/state/prime") prime_data = yaml.safe_load(prime_state.read_text()) print(f"Primed files tracked with {name}: {prime_data.get('files')}") ``` ### Relevant log output ```shell Primed files tracked with no override-prime: {'hello.txt'} Primed files tracked with override-prime: set() ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 45
Quick Win: 24.75
Staleness: 80
Complexity: 45
Confidence: 85
Support Request: 0
needs triage craft-parts writes an empty fileset to prime state when a part uses override-prime, since the scriptlet path in _run_step returns no tracked contents. Bug confirmed still present in current code; unlabelled, no comments; downstream snapcraft issue still open.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 40
Confidence: 85
Support Request: 5
needs triage craft-parts fails to track primed files when using override-prime, returning an empty fileset and causing downstream snapcraft issues. Unassessed after 406 days with no maintainer comments or labels.
qwen3.6-35b-a3b-mtp-q6
Staleness: 90
Complexity: 40
Confidence: 85
Support Request: 5
needs triage override-prime causes craft-parts to return an empty fileset for tracked primed files, breaking downstream snapcraft functionality. The report is unlabelled, has no maintainer response, and has been inactive for over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 30
Confidence: 80
Support Request: 10
needs triage craft-parts returns an empty fileset when using override-prime, breaking primed file tracking. Open 374 days with zero comments. Awaiting triage and fix.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/snapcraft#5552 (confidence 90%)

    Downstream bug (primed-stage-packages missing from manifest.yaml with override-prime) still open and triaged as blocked by this craft-parts issue.

  • Related To: canonical/snapcraft#4547 (confidence 70%)

    Referenced in the issue body as a downstream consequence; closed via a warning in PR #4553 rather than fixing the root cause.

Related issues

Issue Project State Summary Similarity
#5552 `primed-stage-packages` isn't in manifest.yaml when using override-prime snapcraft open primed-stage-packages missing from manifest.yaml when override-prime is used; triaged bug blocked by upstream craft-parts issue #1122 which remains open. No fix implemented in ~15 months.
76%
#2097440 override-prime disables primed-stage-packages snapcraft (launchpad) open Bug report: using override-prime in a part causes primed-stage-packages to be empty in the manifest, even when stage-packages are specified. Untriaged, 576 days old.
73%
#1917897 Files created in override-stage fail to get copied to prime snapcraft (launchpad) open Reporter's override-stage creates a symlink (usr/bin/awk) that is not copied into prime/, so it's missing from the snap. No maintainer response, no labels, 0 comments; ~5.5 years old. Likely a craft-parts fileset-tracking gap for scriptlet-created files.
72%
#1876260 missing SNAPCRAFT_PART_* variables in override-prime snapcraft (launchpad) closed Closed without resolution. The missing SNAPCRAFT_PART_* variables in override-prime remain unaddressed, likely abandoned due to inactivity.
70%