Bug#772732: apt-auto-removal removes too many images from APT::NeverAutoRemove
Package: apt
Version: 1.0.9.4
Severity: important
Tags: patch
The details are explained in the attached patch, but the summary is that
apt-auto-removal also matches i386's image meta-packages when it checks
which images are installed. This causes it to remove too many image
packages from the APT::NeverAutoRemove list in
/etc/apt/apt.conf.d/01autoremove-kernels.
-- Package-specific info:
-- (/etc/apt/preferences present, but not submitted) --
-- (/etc/apt/sources.list present, but not submitted) --
-- System Information:
Debian Release: 8.0
APT prefers unstable
APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 3.16.0-4-586
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages apt depends on:
ii debian-archive-keyring 2014.3
ii gnupg 1.4.18-6
ii libapt-pkg4.12 1.0.9.4
ii libc6 2.19-13
ii libgcc1 1:4.9.2-6
ii libstdc++6 4.9.2-6
apt recommends no packages.
Versions of packages apt suggests:
pn apt-doc <none>
ii aptitude 0.6.11-1+b1
ii dpkg-dev 1.17.22
ii python-apt 0.9.3.11
-- no debconf information
>From 677a4b00aeecf1b5433a669ce7ed765908cdd96d Mon Sep 17 00:00:00 2001
From: James McCoy <jamessan@debian.org>
Date: Wed, 10 Dec 2014 10:16:02 -0500
Subject: [PATCH] Tighten filtering of kernel images in apt.auto-removal
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The current filtering matches the names of the image metapackages on the
i386 architecture.
$ dpkg-query -l | awk '/^ii[ ]+(linux|kfreebsd|gnumach)-image-[0-9]/ && $2 !~ /-dbg$/ { print $2 }'
linux-image-3.16.0-4-586
linux-image-586
This results in an extra image package being removed from
APT::NeverAutoRemove, losing the intended effect of keeping the {current,
previous, latest} set of images installed.
Requiring a “.” in the package name tightens the matched package names
to those that are installing a specific version of the image, thus
eliding the meta-packages.
Signed-off-by: James McCoy <jamessan@debian.org>
---
debian/apt.auto-removal.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/debian/apt.auto-removal.sh b/debian/apt.auto-removal.sh
index c004161..807c6f7 100644
--- a/debian/apt.auto-removal.sh
+++ b/debian/apt.auto-removal.sh
@@ -41,7 +41,7 @@ version_test_gt ()
return "$?"
}
-list="$(${DPKG} -l | awk '/^ii[ ]+(linux|kfreebsd|gnumach)-image-[0-9]/ && $2 !~ /-dbg$/ { print $2 }' | sed -e 's#\(linux\|kfreebsd\|gnumach\)-image-##')"
+list="$(${DPKG} -l | awk '/^ii[ ]+(linux|kfreebsd|gnumach)-image-[0-9]+\./ && $2 !~ /-dbg$/ { print $2 }' | sed -e 's#\(linux\|kfreebsd\|gnumach\)-image-##')"
latest_version=""
previous_version=""
--
2.1.3
Reply to: