[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#838471: apt: kernel apt-auto-removal does not escape + chars



Package: apt
Version: 1.0.9.8.3
Severity: normal
Tags: patch

Dear Maintainer,

   * What led up to the situation?

Installing a custom kernel package including a + char in the pkg name (f.e. linux-image-4.4.17+48-ph)

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

apt-get autoremove

   * What was the outcome of this action?

It tries to remove those packages even they're excluded via APT::NeverAutoRemove.

See:
# grep linux-image-4 /etc/apt/apt.conf.d/ -r  
/etc/apt/apt.conf.d/01autoremove-kernels:   "^linux-image-4\.4\.17+48-ph$";
/etc/apt/apt.conf.d/01autoremove-kernels:   "^linux-image-4\.4\.21+56-ph$";

   * What outcome did you expect instead?

It should skip autoremoving those packages.

The problem can be fixed by the following patch:
--- a/etc/kernel/postinst.d/apt-auto-removal     2016-03-12 14:32:33.000000000 +0100
+++ b/etc/kernel/postinst.d/apt-auto-removal    2016-09-21 12:17:50.732936977 +0200
@@ -66,7 +66,7 @@ fi
 kernels="$(echo "$latest_version
 $installed_version
 $running_version
-$previous_version" | sort -u | sed -e 's#\.#\\.#g' )"
+$previous_version" | sort -u | sed -e 's#\.#\\.#g' -e 's#\+#\\+#g' )"
 
 generateconfig() {
        cat <<EOF



-- Package-specific info:

-- (no /etc/apt/preferences present) --

-- System Information:
Debian Release: 8.5
  APT prefers proposed-updates
  APT policy: (500, 'proposed-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.4.17+48-ph (SMP w/16 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages apt depends on:
ii  debian-archive-keyring  2014.3
ii  gnupg                   1.4.18-7+deb8u3
ii  libapt-pkg4.12          1.0.9.8.3
ii  libc6                   2.19-18+deb8u5
ii  libgcc1                 1:4.9.2-10
ii  libstdc++6              4.9.2-10

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.27
ii  python-apt  0.9.3.12

-- no debconf information


Reply to: