Bug#742318: apt: version 'amd64' has bad syntax
Package: apt
Version: 0.9.16.1
Severity: normal
/etc/kernel/postinst.d/apt-auto-removal is run when installing a new
linux-image package. A package list is generated at some point, and
version numbers extracted:
dpkg -l | awk '/^ii[ ]+(linux|kfreebsd|gnumach)-image-[0-9]*/ && $2 !~ /-dbg$/ { print $2 }' | sed -e 's#\(linux\|kfreebsd\|gnumach\)-image-##'
produces this list:
3.11-2-amd64
3.12-1-amd64
3.13-1-amd64
amd64
Internal function `version_test_gt' is then called (inside a `for'
loop) to set two variables ('latest_version' and 'previous_version').
When it comes to the last list member (see list above), a warning
shows up:
dpkg: warning: version 'amd64' has bad syntax: version number does not start with digit
The patch bellow keeps odd things away from being thrown at `dpkg
--compare-versions':
--- apt-auto-removal.orig 2014-03-14 10:03:02.000000000 +0100
+++ apt-auto-removal 2014-03-20 19:42:02.337443101 +0100
@@ -46,6 +46,11 @@
latest_version=""
previous_version=""
for i in $list; do
+ case $i in
+ [!0-9]*)
+ continue
+ ;;
+ esac
if version_test_gt "$i" "$latest_version"; then
previous_version="$latest_version"
latest_version="$i"
-- System Information:
Debian Release: jessie/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.13-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Versions of packages apt depends on:
ii debian-archive-keyring 2012.4
ii gnupg 1.4.16-1.1
ii libapt-pkg4.12 0.9.16.1
ii libc6 2.18-4
ii libgcc1 1:4.8.2-16
ii libstdc++6 4.8.2-16
apt recommends no packages.
Versions of packages apt suggests:
ii apt-doc 0.9.16.1
pn aptitude | synaptic | wajig <none>
ii dpkg-dev 1.17.6
ii python-apt 0.9.3.4
--===============3830908771293557972==
Content-Type: text/x-diff; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="apt-auto-removal.patch"
--===============3830908771293557972==--
Reply to: