← Back to issue list

oci: set default PATH when missing or empty

View original Github issue

Metadata

Project
rockcraft
Number
#1113
Type
pull request
State
open
Author
gcomneno
Labels
Created
Updated
Closed

Current evaluation

Generalizes empty-PATH protection from bare-only to all OCI bases by inspecting final image env via skopeo. Author rebased and re-verified 31 days ago; no maintainer review yet. CI green, 0 reviewers assigned.

Suggested action: needs review

Reason: The PR addresses still-open issue #729 and the current code in oci.py:408 still gates on base != 'bare', confirming the change is unmerged and relevant. The author rebased and re-ran tests 31 days ago with 51 passing, but no maintainer has been assigned as reviewer in ~6 months. Needs a maintainer to review the behavioral change (applying to all bases) and the reordering of set_default_path after set_environment in package.py.

Impact: 55 Quick Win: 30.25 Staleness: 45 Complexity: 45 Confidence: 72

Issue body

### Summary This PR generalizes the empty-`PATH` protection for OCI images (issue #729). Previously this behavior applied only when `base == "bare"`. The final image environment is now inspected for every base, after project-defined environment variables have been applied. ### Behavior - If `PATH` is missing or its final value is empty (`PATH=`), set it to `Pebble.DEFAULT_ENV_PATH`. - If the final `PATH` value is non-empty, preserve it. - When multiple `PATH` entries exist, the last assignment wins. The implementation reads the final image environment through `skopeo inspect` and writes the default only when necessary. ### Packaging order `set_default_path()` runs after `set_environment()`, preventing a project-level `PATH: ""` from overwriting the safe default after validation. ### Tests Unit coverage includes: - `PATH` present: inspect only, no config write; - `PATH` missing: inspect and configure the default; - `PATH` empty: inspect and configure the default; - duplicate `PATH` entries with last-assignment semantics; - package orchestration applying project environment before final `PATH` validation. Validation performed: - focused OCI and package-service suite: 56 passed; - unit suite: 644 passed, 1 environment-dependent APT test deselected; - the deselected APT test fails identically on current `upstream/main` because the local environment lacks the APT package backend; - Ruff check and format check passed for all four changed files; - `git diff --check` passed. Refs #729

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 55
Quick Win: 30.25
Staleness: 45
Complexity: 45
Confidence: 72
needs review Generalizes empty-PATH protection from bare-only to all OCI bases by inspecting final image env via skopeo. Author rebased and re-verified 31 days ago; no maintainer review yet. CI green, 0 reviewers assigned.
qwen/qwen3.6-35b-a3b
Staleness: 65
Complexity: 20
Confidence: 90
needs review Generalizes empty PATH protection for OCI images by inspecting the final environment and setting a safe default when missing or empty. Currently awaiting maintainer review after author follow-ups.
qwen/qwen3.6-35b-a3b
Staleness: 25
Complexity: 20
Confidence: 85
needs review Generalizes PATH protection for OCI images to apply to all base images, conditionally setting a default via skopeo inspect. Currently awaiting maintainer review with passing CI and unit tests.
qwen3.6-35b-a3b-mtp-q6
Staleness: 20
Complexity: 25
Confidence: 85
needs review Generalizes PATH defaulting for OCI images when missing or empty. Rebased, tests pass, lint clean, awaiting maintainer review after author follow-ups.
qwen3.6-35b-a3b-mtp-q6
Staleness: 40
Complexity: 25
Confidence: 85
needs review Generalizes PATH defaulting for OCI images to apply to all bases, not just bare. Tests pass, author rebased and pinged maintainers. Currently awaiting maintainer review.
qwen3.6-35b-a3b-mtp-q6
Staleness: 20
Complexity: 10
Confidence: 80
needs review Generalizes OCI image PATH defaults to all bases, applying Pebble.DEFAULT_ENV_PATH only when missing or empty. Tests and linting pass. Awaiting review and merge.

Update history

Date Change
updated

Related work

  • Related To: rockcraft#729 (confidence 90%)

    Issue explicitly requests generalizing empty PATH detection; this PR is the implementation.

  • Related To: rockcraft#725 (confidence 85%)

    Previously merged PR that added bare-only PATH fix; this PR generalizes that behavior to all bases.

Related issues

No related issues found above the similarity threshold.