diff -Nru livecd-rootfs-2.578.5/debian/changelog livecd-rootfs-2.578.6/debian/changelog --- livecd-rootfs-2.578.5/debian/changelog 2019-05-30 21:13:55.000000000 +0200 +++ livecd-rootfs-2.578.6/debian/changelog 2019-07-16 11:43:44.000000000 +0200 @@ -1,3 +1,13 @@ +livecd-rootfs (2.578.6) disco; urgency=medium + + * Backport error-checking on determining snap bases. LP: #1828500. + + [ Tobias Koch ] + * Do proper error checking when calling snap-tool info to determine + the base of a snap. + + -- Tobias Koch Tue, 16 Jul 2019 11:43:44 +0200 + livecd-rootfs (2.578.5) disco; urgency=medium [ Balint Reczey ] diff -Nru livecd-rootfs-2.578.5/live-build/functions livecd-rootfs-2.578.6/live-build/functions --- livecd-rootfs-2.578.5/live-build/functions 2019-05-30 21:13:55.000000000 +0200 +++ livecd-rootfs-2.578.6/live-build/functions 2019-07-16 11:43:24.000000000 +0200 @@ -483,12 +483,20 @@ ;; *) # Determine if and what core snap is needed - local core_snap=$(/usr/share/livecd-rootfs/snap-tool info \ + local snap_info + + snap_info=$(/usr/share/livecd-rootfs/snap-tool info \ --cohort-key="${COHORT_KEY:-}" \ - --channel="$CHANNEL" "$SNAP_NAME" | \ - grep '^base:' | awk '{print $2}' + --channel="$CHANNEL" "${SNAP_NAME}" \ ) + if [ $? -ne 0 ]; then + echo "Failed to retrieve base of $SNAP_NAME!" + exit 1 + fi + + local core_snap=$(echo "$snap_info" | grep '^base:' | awk '{print $2}') + # If $core_snap is not the empty string then SNAP itself is not a core # snap and we must additionally seed the core snap. if [ -n "$core_snap" ]; then