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

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



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/msg00005.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

Attachment: signature.asc
Description: Digital signature


Reply to: