Bug#787827: Broken version comparison in kernel postinst hook (apt-auto-removal)

2015-06-10 Thread David Kalnischkies
Control: tags -1 newcomer

On Fri, Jun 05, 2015 at 01:58:08PM +0100, Ben Hutchings wrote:
 Firstly, the script is currently not stripping the architecture from
 names of foreign kernel packages, so I get these error messages:
 
 /etc/kernel/postinst.d/apt-auto-removal:
 dpkg: error: version '3.16.0-4-amd64:amd64' has bad syntax: epoch in version 
 is not number
 dpkg: error: version '3.16.0-4-amd64:amd64' has bad syntax: epoch in version 
 is not number
 dpkg: error: version '3.2.0-4-amd64:amd64' has bad syntax: epoch in version 
 is not number
 dpkg: error: version '3.2.0-4-amd64:amd64' has bad syntax: epoch in version 
 is not number
 dpkg: error: version '4.0.0-1-amd64:amd64' has bad syntax: epoch in version 
 is not number
 dpkg: error: version '4.0.0-1-amd64:amd64' has bad syntax: epoch in version 
 is not number

This is caused by 'dpkg-query -l' now printing 'pkg:arch' in the name
column since commit d658a8ec1110c9b3b20987cd903a54f59801117f (= 1.18)
for packages from a non-native architecture, which was actually one of
the things reverted for the MultiArch dpkg implementation in Debian as
discussed e.g. here:
https://lists.debian.org/debian-dpkg/2011/12/msg5.html
At the very least we are a lot closer to having a similar interface in
apt and dpkg now, which probably means that decision will be reverted…
aka: This only effects stretch and upward, not jessie.


Anyway, should be fixed anyhow for the unlikely event of M-A:same kernel
packages emerging regardless of what will dpkg do in the end as it
always prints the architecture for those.


 Secondly, version comparisons between kernel release strings should be
 done using the linux-version command from linux-base, not dpkg.  dpkg
 does not know that e.g. 4.1-rc6 comes before 4.1.

linux-base is prio:optional. Even through Debians Kernelpackages depend
on it, some derivatives don't (popcon indicates that). The script is
also called by kfreebsd and hurd kernel postinsts, where I suspect this
package to be found even less likely (even through it is arch:all, so it
should be available). I would very much prefer a portable
implementation without new dependencies; beside, the script rewrites
4.1-rc6 to 4.1~rc6 for the version comparison so we should be 'fine'
here in your example.

I guess we are better of finding the debian version of the kernel
packages for the sorting instead of deriving the version number from the
package name – and we should group kernels by that version rather than
avoiding certain matches explicitly (-dbg). I suspect the current
implementation to not behave very well on systems with multiple kernel
flavours (rt,pae,…) installed for example.


That could be an interesting project for a shell¹ scripter with close to
zero apt knowledge required to make it happen, but making a difference
on millions of computers – hence tagging newcomer.
Feel free to contact me by mail, IRC #debian-apt or at DebCamp/Conf15.

(I guess I will grab this myself in a few months if we have no volunteer
as its a bug(s) which should be fixed, but I have other apt projects
until then, so me tagging it 'newcomer' is actually a try to get it
fixed faster rather than putting it in the 'never too be touched again'
basket most newcomer bugs usually end up in unfortunately. So, grab it…)

¹ sorry, no perl. We have nobody who could review/maintain that.


Best regards

David Kalnischkies


signature.asc
Description: Digital signature


Bug#787827: Broken version comparison in kernel postinst hook (apt-auto-removal)

2015-06-05 Thread Ben Hutchings
Package: apt
Version: 1.0.9.10
Severity: important

Firstly, the script is currently not stripping the architecture from
names of foreign kernel packages, so I get these error messages:

/etc/kernel/postinst.d/apt-auto-removal:
dpkg: error: version '3.16.0-4-amd64:amd64' has bad syntax: epoch in version is 
not number
dpkg: error: version '3.16.0-4-amd64:amd64' has bad syntax: epoch in version is 
not number
dpkg: error: version '3.2.0-4-amd64:amd64' has bad syntax: epoch in version is 
not number
dpkg: error: version '3.2.0-4-amd64:amd64' has bad syntax: epoch in version is 
not number
dpkg: error: version '4.0.0-1-amd64:amd64' has bad syntax: epoch in version is 
not number
dpkg: error: version '4.0.0-1-amd64:amd64' has bad syntax: epoch in version is 
not number

Secondly, version comparisons between kernel release strings should be
done using the linux-version command from linux-base, not dpkg.  dpkg
does not know that e.g. 4.1-rc6 comes before 4.1.

Ben.

-- Package-specific info:

-- (/etc/apt/preferences present, but not submitted) --


-- (no /etc/apt/sources.list present) --


-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Foreign Architectures: amd64, ppc64el, powerpc

Kernel: Linux 4.0.0-2-686-pae (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (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.19-3
ii  libapt-pkg4.12  1.0.9.10
ii  libc6   2.19-18
ii  libgcc1 1:5.1.1-9
ii  libstdc++6  5.1.1-9

apt recommends no packages.

Versions of packages apt suggests:
pn  apt-doc none
ii  aptitude0.6.11-1+b1
ii  dpkg-dev1.18.1
ii  python-apt  0.9.4
ii  synaptic0.81.3

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org