[Top][All Lists]

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

Re: [PATCH] Correct sorting of kernel names containing '_'

From: Robbie Harwood
Subject: Re: [PATCH] Correct sorting of kernel names containing '_'
Date: Wed, 19 Jan 2022 13:52:40 -0500

Glenn Washburn <> writes:

> This seems like a simple solution. Not being in the weeds on this, can
> you comment on the short coming of changing the '_' to '-'? Are there
> any known version string formats where this would be worse? At the
> moment, it seems like a good incremental solution.

I think in order for it to be a problem, someone / some packaging system
would have to be relying on '_' to not be part of the version.  All
package managers I'm aware of have the version at the end - i.e., after
the package name.[1]

The only real "drawback" I'm aware of is that this still leaves (and any other inconsistencies
between distro sort and `sort -V`) unaddressed - but none of the other
proposals listed would help with that either.  (Fedora avoids this
particular issue by mandating prerelease versions start with 0 - for
instance, rather than making the 3.16.0-rc6 as gentoo did in that bug,
we make 3.16.0-0.rc6 .)

>> - Invoke rpmdev-vercmp if available.  Problem here is that it may not be
>>   (it's not part of the rpm package itself on Fedora, but rather
>>   rpmdev-tools), and again, won't generalize to non-RPM distros.
> I like this as a supplement to this patch. I'm thinking first identify
> the distro (using /etc/os-release?), if known RPM distro look for
> rpmdev-vercmp, else look for dpkg (to use dpkg --compare-versions), and
> if neither is found fall back to this approach. This could be extended
> to other package manager compare logic as desired.

Interesting.  Doing this for rpmdev-vercmp alone still doesn't seem
worth the effort to me, but dpkg --compare-versions is more attractive
since it'll be installed for sure.  I'll see if I can make something

>> - Strip out any dot-delimited section that contains non-numerics.
>> This has also been written and is the attached solution to
>> - but since it hasn't been
>> merged in the six years since posting, I have to assume it's been
>> rejected.  It also would not correctly handle the case of
>> e.g. kernel-core-2.6.32-1_test2.x86_64 vs kernel-core-2.6.32-1.x86_64
> This patch actually removes the last part of the version string
> starting with the first dot segment whose first character is
> non-numeric. Regardless, this doesn't seem like a great approach.

Oops, yes.

Be well,

1: This ignores things like epoch, but I'm not aware of any distro using
   an epoch-like versioning for the kernel, nor does it seem likely that
   Linux will change its versioning scheme in a way that breaks "normal"
   version sorting.  It would also be broken right now, though, which is
   why I've buried mention of it it in a footnote :)

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]