From 245f7772bdb743547e4d2f7df2475afc0eb5ec1e Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Tue, 11 Jan 2022 16:32:51 -0800 Subject: [PATCH] Treat it as a fatal error if we are asked to install a snap that would pull in the core snap. Ubuntu 20.04 and Ubuntu 22.04 official images should never require snaps that depend on an Ubuntu 16.04 runtime, this indicates a misconfiguration that will bloat the install. --- debian/changelog | 4 ++++ live-build/functions | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5f77be3a..10d8898d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,10 @@ livecd-rootfs (2.750) UNRELEASED; urgency=medium * Do not look for a base snap on snaps of type base, because recursive dependencies are not allowed for snaps. LP: #1957123. + * Treat it as a fatal error if we are asked to install a snap that would + pull in the core snap. Ubuntu 20.04 and Ubuntu 22.04 official images + should never require snaps that depend on an Ubuntu 16.04 runtime, this + indicates a misconfiguration that will bloat the install. -- Steve Langasek Tue, 11 Jan 2022 15:38:05 -0800 diff --git a/live-build/functions b/live-build/functions index 652b6382..e0e17a3e 100644 --- a/live-build/functions +++ b/live-build/functions @@ -597,8 +597,12 @@ _snap_preseed() { if [ "$snap_type" != base ]; then local core_snap=$(echo "$snap_info" | awk '/^base:/ {print $2}') - # If snap info does not list a base use 'core' - core_snap=${core_snap:-core} + # If snap info does not list a base the default is 'core' + # which is now an error to use. + if [ -z "$core_snap" ]; then + echo "Legacy snap with no base declaration found, refusing to install 'core' snap" + exit 1 + fi _snap_preseed $CHROOT_ROOT $core_snap stable fi