[Toybox] sort -V
Rob Landley
rob at landley.net
Wed Dec 19 12:00:25 PST 2018
On 12/19/18 1:41 PM, enh via Toybox wrote:
> it turns out that we have a few users of `sort -V`. i'd always assumed
> this meant "use the GNU strverscmp(3) function as your comparator" but
> no, it's slightly different...
>
> https://www.gnu.org/software/coreutils/manual/html_node/Details-about-version-sort.html
That's really unpleasant.
> the first github match for that function says this:
>
> This implements the algorithm for comparison of version strings
> specified by Debian and now widely adopted. The detailed
> specification can be found in the Debian Policy Manual in the
> section on the 'Version' control field. This version of the code
> implements that from s5.6.12 of Debian Policy v3.8.0.1
> http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
That's outright insane.
> at which point i _wish_ it was just the stupid strverscmp...
While I have some experience in this area:
https://github.com/landley/aboriginal/blob/master/sources/functions.sh#L248
It's not a happy thing.
What is the _context_ of the users of sort -V? If I do try to implement
something, what does success look like here? (Do we have a sort.test patch we
can start with?)
Rob
P.S. Still trying to finish grep --color, probably not getting to this today...
More information about the Toybox
mailing list