Validity of `base` is not checked when using `--destructive-mode`
Metadata
Current evaluation
Base validation in destructive mode was fixed in Snapcraft 8.1 via craft-application 2.0 and canonical/craft-application PR #263.
Resolution: closed resolved
Reason: The maintainer confirmed enforcement for core24 snaps in Snapcraft 8.1 through craft-application 2.0. The fix was delivered by canonical/craft-application PR #263.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
When building a snap with `snapcraft --destructive-mode` (or setting the corresponding environment variable), the `base` of the snap is not checked.
The `base` is installed as a prerequisite (`build-snap`) on the host system; so long as the base is a valid target to `snap install`, no additional checks are run.
### To Reproduce
```
mkdir test && cd test
snapcraft init
sed -i 's/base: core22/base: core24/' snap/snapcraft.yaml
snapcraft --destructive-mode
```
### Environment
Any Ubuntu base, snapcraft 8.x.
### snapcraft.yaml
```shell
name: my-snap-name # you probably want to 'snapcraft register <name>'
base: core24 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
This is my-snap's description. You have a paragraph or two to tell the
most important story about your snap. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the snap
store.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
parts:
my-part:
# See 'snapcraft plugins'
plugin: nil
```
### Relevant log output
```shell
dilyn@Ares:~/test -> snapcraft --destructive-mode --verbosity=trace
Starting Snapcraft 8.0.2.post14+git89961cfc
Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20240205-180421.093035.log'
2024-02-05 18:04:21.093 Starting Snapcraft 8.0.2.post14+git89961cfc
2024-02-05 18:04:21.093 Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20240205-180421.093035.log'
2024-02-05 18:04:21.093 Raw pre-parsed sysargs: args={'help': False, 'verbose': False, 'quiet': False, 'verbosity': 'trace', 'version': False, 'trace': False} filtered=['--destructive-mode']
2024-02-05 18:04:21.094 Using default command: 'pack'
2024-02-05 18:04:21.094 General parsed sysargs: command='pack' args=['--destructive-mode']
2024-02-05 18:04:21.094 Command parsed sysargs: Namespace(destructive_mode=True, use_lxd=False, debug=False, enable_manifest=True, manifest_image_information=None, bind_ssh=False, build_for=None, http_proxy=None, https_proxy=None, ua_token=None, enable_experimental_ua_services=False, enable_experimental_plugins=False, enable_experimental_extensions=False, enable_developer_debug=False, enable_experimental_target_arch=False, target_arch=None, provider=None, directory=None, output=None)
2024-02-05 18:04:21.095 lifecycle command: 'pack', arguments: Namespace(destructive_mode=True, use_lxd=False, debug=False, enable_manifest=True, manifest_image_information=None, bind_ssh=False, build_for=None, http_proxy=None, https_proxy=None, ua_token=None, enable_experimental_ua_services=False, enable_experimental_plugins=False, enable_experimental_extensions=False, enable_developer_debug=False, enable_experimental_target_arch=False, target_arch=None, provider=None, directory=None, output=None)
2024-02-05 18:04:21.095 command: pack, arguments: Namespace(destructive_mode=True, use_lxd=False, debug=False, enable_manifest=True, manifest_image_information=None, bind_ssh=False, build_for=None, http_proxy=None, https_proxy=None, ua_token=None, enable_experimental_ua_services=False, enable_experimental_plugins=False, enable_experimental_extensions=False, enable_developer_debug=False, enable_experimental_target_arch=False, target_arch=None, provider=None, directory=None, output=None)
2024-02-05 18:04:21.104 Created build plan:
build-on: amd64 build-for: amd64
2024-02-05 18:04:21.105 CPU count (from process affinity): 24
2024-02-05 18:04:21.105 Invalid SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT ''
2024-02-05 18:04:21.105 Running on amd64 for amd64
2024-02-05 18:04:21.106 Initializing parts lifecycle
2024-02-05 18:04:21.106 is_snap: True, SNAP_NAME set to snapcraft
2024-02-05 18:04:21.107 process my-part:Step.PULL
2024-02-05 18:04:21.107 add action my-part:Step.PULL(ActionType.RUN)
2024-02-05 18:04:21.107 process my-part:Step.BUILD
2024-02-05 18:04:21.107 add action my-part:Step.BUILD(ActionType.RUN)
2024-02-05 18:04:21.107 process my-part:Step.STAGE
2024-02-05 18:04:21.107 add action my-part:Step.STAGE(ActionType.RUN)
2024-02-05 18:04:21.108 process my-part:Step.PRIME
2024-02-05 18:04:21.108 add action my-part:Step.PRIME(ActionType.RUN)
2024-02-05 18:04:21.108 Installing build-packages
2024-02-05 18:04:21.108 Installing build-snaps
2024-02-05 18:04:21.528 Installing snap: core24
2024-02-05 18:04:24.157 verify plugin environment for part 'my-part'
2024-02-05 18:04:24.158 Pulling my-part
2024-02-05 18:04:24.158 execute action my-part:Action(part_name='my-part', step=Step.PULL, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None))
2024-02-05 18:04:24.166 Building my-part
2024-02-05 18:04:24.166 execute action my-part:Action(part_name='my-part', step=Step.BUILD, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None))
2024-02-05 18:04:24.166 load state file: /home/dilyn/test/parts/my-part/state/pull
2024-02-05 18:04:24.203 remove directory /home/dilyn/test/parts/my-part/build
2024-02-05 18:04:24.205 Executing PosixPath('/home/dilyn/test/parts/my-part/run/build.sh')
2024-02-05 18:04:27.739 Staging my-part
2024-02-05 18:04:27.740 execute action my-part:Action(part_name='my-part', step=Step.STAGE, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None))
2024-02-05 18:04:27.759 Priming my-part
2024-02-05 18:04:27.759 execute action my-part:Action(part_name='my-part', step=Step.PRIME, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None))
2024-02-05 18:04:27.779 patch_elf: not enabled for part 'my-part'
2024-02-05 18:04:27.780 Extracting and updating metadata...
2024-02-05 18:04:27.780 Copying snap assets...
2024-02-05 18:04:27.780 Generating snap metadata...
2024-02-05 18:04:27.782 Generated snap metadata
2024-02-05 18:04:27.782 Generating snap manifest...
2024-02-05 18:04:27.782 load state file: /home/dilyn/test/parts/my-part/state/pull
2024-02-05 18:04:27.786 load state file: /home/dilyn/test/parts/my-part/state/prime
2024-02-05 18:04:27.790 Generated snap manifest
2024-02-05 18:04:27.800 Reading snap metadata...
2024-02-05 18:04:27.801 Running linters...
2024-02-05 18:04:27.801 Running linter: classic
2024-02-05 18:04:27.801 Running linter: library
2024-02-05 18:04:27.806 pack_snap: output=None, compression='xz'
2024-02-05 18:04:27.807 pack_snap: check skeleton
2024-02-05 18:04:27.824 Creating snap package...
2024-02-05 18:04:27.824 Pack command: ['snap', 'pack', '--filename', 'my-snap-name_0.1_amd64.snap', '--compression', 'xz', PosixPath('/home/dilyn/test/prime'), PosixPath('/home/dilyn/test')]
2024-02-05 18:04:27.850 Created snap package my-snap-name_0.1_amd64.snap
```
### Additional context
In the specific case of using a dev-level base (as core24 is), this behavior should at least be locked behind `grade: devel` so as to avoid allowing publishing potentially broken snaps to stable or candidate tracks in the store.
It may also be preferable to disallow using `base: coreXX` under any circumstances when that base has yet to be officially released (that is to say, while its usage when not using `--destructive-mode` is still guarded by a `build-base` check).
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Base validation in destructive mode was fixed in Snapcraft 8.1 via craft-application 2.0 and canonical/craft-application PR #263. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed in Snapcraft 8.1 via craft-application 2.0 and merged PR canonical/craft-application#263, which enforces base compatibility for core24 destructive-mode builds. | |
| stealth/space-bunny-alpha | — | closed resolved | Resolved in snapcraft 8.1 via craft-application 2.0 and merged PR canonical/craft-application#263, which blocks builds on incompatible bases, including core24 in destructive mode. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved in snapcraft 8.1 via craft-application 2.0 and canonical/craft-application#263. Base validity is now enforced during destructive-mode builds, blocking invalid or unreleased bases. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed in Snapcraft 8.1 via craft-application 2.0. Base validity is now properly enforced during destructive mode builds, preventing invalid bases from being accepted without checks. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved in snapcraft 8.1 via craft-application 2.0 and PR #263. Base validity is now enforced during destructive mode builds, preventing invalid or unreleased bases. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Resolved in snapcraft 8.1 via craft-application 2.0. Base validity is now enforced during destructive-mode builds, preventing invalid or unreleased bases from bypassing checks. Fixed via canonical/craft-application#263. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/craft-application#263
(confidence 99%)
Added the base compatibility enforcement used by Snapcraft 8.1.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #761 models/project.py: do not check for base when build-base: devel | craft-application | closed | Rejected unmerged: craft-application retained default devel base/build-base validation; Snapcraft was told to add a gadget-specific _validate_devel_base override. | |
| #5388 fix: don't fail when checking the base | snapcraft | merged | Merged PR #5388 in commit 5c43d861c, deferring base-check failures so invalid base definitions reach Snapcraft's user-friendly validation errors (SNAPCRAFT-313). | |
| #4721 feat: validate devel bases with craft-application | snapcraft | closed | Superseded by canonical/snapcraft#4796, merged as commit 5dad5eb62, which upgraded craft-application to 2.7.0 and adopted its devel-base validation. | |
| #4972 Cannot create a snap with base:bare in destructive mode | snapcraft | open | Snapcraft 8.3.2 mishandled bare-base projects without build-base, producing architecture/platform errors; current models require build-base and fail early during validation. |