is_effective_base_eol() crashes with UnknownVersionError on build-base: devel
Metadata
Current evaluation
Fixed by PR #1153, merged as commit 9c757100: devel and other unknown bases are now treated as supported in is_effective_base_eol().
Resolution: closed resolved
Reason: PR #1153 was merged as commit 9c757100. The fix prevents is_effective_base_eol() from crashing by treating devel and bases unknown to distro-support as supported.
Evaluated by: mr-cal-bot
No scores available.
Issue body
> **Note:** This issue was drafted by an AI assistant (GitHub Copilot CLI) on behalf of @lengau, based on investigation of a spread test failure in `canonical/imagecraft`.
### Bug Description
`ProjectService.is_effective_base_eol()` does not handle a `build-base`/`base` of `devel` (or any base unrecognized by `distro-support`) the same way its sibling methods do, causing an unhandled `UnknownVersionError` crash.
Both `check_base_is_supported()` and `base_eol_soon_date()` already special-case or defensively catch this:
- `check_base_is_supported()` explicitly treats a `devel` series as always-supported:
```python
if build_base.series == "devel":
build_base = None
```
- `base_eol_soon_date()` catches the error and assumes the base is supported:
```python
except (UnknownDistributionError, UnknownVersionError):
# If distro-support doesn't know about this base, assume it's supported.
return None
```
However, `is_effective_base_eol()` has neither protection:
```python
def is_effective_base_eol(self) -> bool:
"""Determine whether the base on which to build is end-of-life."""
base = craft_platforms.DistroBase.from_str(self.get().effective_base)
return not self._is_supported_on(base=base, date=datetime.date.today())
```
This method is called from `commands/lifecycle.py::_check_supported_base()` specifically on the `--ignore=unmaintained` path:
```python
if "unmaintained" in ignore_items:
if project_service.is_effective_base_eol():
...
```
So any project with `build-base: devel` (or `base: devel`) that runs `pack --ignore=unmaintained` crashes with:
```
distro_support.errors.UnknownVersionError: Unknown version ubuntu devel
```
This is closely related to #986, but that issue was about an outdated pinned `distro-support` version for a *real* series (`ubuntu@26.04`), fixed by bumping the dependency. This case is different: `devel` is never going to be a version `distro-support` recognizes, so bumping the dependency won't fix it — the code path itself needs the same `devel`/`UnknownVersionError` handling used elsewhere.
### To Reproduce
1. Create a project with:
```yaml
base: bare
build-base: devel
```
2. Run `<app> pack --ignore=unmaintained`.
### Relevant log output
```
imagecraft internal error: UnknownVersionError('Unknown version ubuntu devel')
Traceback (most recent call last):
...
File ".../craft_application/commands/lifecycle.py", line 227, in _check_supported_base
if project_service.is_effective_base_eol():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../craft_application/services/project.py", line 761, in is_effective_base_eol
base = craft_platforms.DistroBase.from_str(self.get().effective_base)
File ".../craft_application/services/project.py", line 694, in _is_supported_on
support_range = distro_support.get_support_range(base.distribution, base.series)
File ".../distro_support/__init__.py", line 19, in get_support_range
raise UnknownVersionError(distribution, version)
distro_support.errors.UnknownVersionError: Unknown version ubuntu devel
```
### Suggested fix
Give `is_effective_base_eol()` the same treatment as `check_base_is_supported()`/`base_eol_soon_date()`: treat a `devel` series as always-supported (not EOL), and/or catch `(UnknownDistributionError, UnknownVersionError)` and assume the base is supported when `distro-support` doesn't recognize it.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by PR #1153, merged as commit 9c757100: devel and other unknown bases are now treated as supported in is_effective_base_eol(). | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by PR #1153, merged as commit 9c757100: devel and other unknown bases are now treated as supported in is_effective_base_eol(). | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. The is_effective_base_eol() crash on build-base devel was fixed by adding UnknownVersionError handling, treating unrecognized bases as supported to match sibling methods. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
0
Complexity:
15
Confidence:
90
Support Request:
5
|
needs triage | is_effective_base_eol() crashes with UnknownVersionError when build-base is devel, unlike sibling methods. Untriaged, awaiting maintainer review. |
Update history
| Date | Change |
|---|---|
| closed | |
| created |
Related work
-
Likely Fixed By:
canonical/craft-application#1153
(confidence 100%)
The resolving PR was merged as commit 9c757100.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1153 fix(project): handle devel bases in is_effective_base_eol() | craft-application | merged | Merged PR #1153 as commit 9c757100, fixing #1152: devel and unknown bases are now handled safely in is_effective_base_eol(), with regression tests. |