packages: handle packages with no candidate (CRAFT-219)
Metadata
Current evaluation
Merged craft-parts#80 via commit aa208282 (merge 0d892afb), adding APT candidate checks and avoiding all-package scans during unmarking to prevent ESM-related crashes.
Resolution: closed resolved
Reason: PR #80 was merged as 0d892afb, containing implementation commit aa208282. It now handles packages without candidates and prevents unnecessary package inspection during unmarking.
Evaluated by: mr-cal-bot
No scores available.
Issue body
A port of the snapcraft PR #3528 by Chris Patterson. Original
description follows:
* Add some checks to ensure package.candidate is not None before using
it. If it is None, when expected to not be `None`, raise a
`PackageNotFoundError` with the name of the package in question.
* Do not iterate over all packages when unmarking. This is the cause of
https://forum.snapcraft.io/t/snapcraft-crash-when-esm-repositories-are-present/24587/8
where a package was being inspected that did not have an available candidate,
causing Snapcraft to fail unnecessarily.
Co-authored-by: Chris Patterson <chris.patterson@canonical.com>
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged craft-parts#80 via commit aa208282 (merge 0d892afb), adding APT candidate checks and avoiding all-package scans during unmarking to prevent ESM-related crashes. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged in craft-parts#80: added missing APT candidate checks and avoided scanning all packages during unmarking, preventing ESM-related crashes. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged. Adds None checks for package candidates, raising PackageNotFoundError. Fixes unmarking crashes with ESM repositories. Port of snapcraft PR #3528. Approved by two reviewers, passed CI, merged with 112 additions and 21 deletions. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Added null checks for package.candidate to raise PackageNotFoundError instead of crashing. Optimized unmarking to avoid full package iteration, resolving failures with ESM repositories. Port of snapcraft PR #3528. |
Update history
No update history recorded yet.
Related work
-
Related To:
snapcraft#3528
(confidence 90%)
The PR describes its change as a port of the upstream Snapcraft fix.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3528 apt cache: improve error handling when packages do not have candidates available (CRAFT-136) (CRAFT-218) | snapcraft | merged | Merged #3528, adding missing APT candidate checks and limiting unmarking to relevant packages, preventing crashes when repositories expose no candidate. |