[Toybox] sort -V test?

enh enh at google.com
Thu Oct 15 16:59:34 PDT 2020


one reason bionic doesn't implement strverscmp() is that afaik not
even the GNU tools use it. they all have slightly different ideas
about how versions should be sorted :-/

(i'll also note that the old behavior matches sort's/librarians'
general "something comes before nothing" rule, so the new behavior
seems like a bug?)

On Thu, Oct 15, 2020 at 4:55 PM Rob Landley <rob at landley.net> wrote:
>
> Following up in the "promote more tests" todo item...
>
> Back when I implemented sort -V, it passed the tests on the host. But since then
> I've switched off of Ubuntu (because they end of lifed the last version without
> systemd) to Devuan, and the -rc and -pre stuff in test_sort is backwards now:
>
> echo -ne
> 'toy-3.12.tar.gz\ntoy-2.37.tar.gz\ntoy-3.4.tar.gz\ntoy-4.16-rc2.tar.gz\ntoy-4.16.tar.gz'
> | sort -V
> --- expected    2020-10-14 19:06:53.480009835 -0500
> +++ actual      2020-10-14 19:06:53.480009835 -0500
> @@ -1,5 +1,5 @@
>  toy-2.37.tar.gz
>  toy-3.4.tar.gz
>  toy-3.12.tar.gz
> -toy-4.16-rc2.tar.gz
>  toy-4.16.tar.gz
> +toy-4.16-rc2.tar.gz
>
> I don't know if this is because of a version upgrade, or downgrade, or what?
> (LANG=c doesn't change it.) Logically the -rc goes before the final release,
> it's an earlier version. But that's not what sort -V in devuan is saying.
> (According to --version i's gnu/gnu/gnu coreutils 8.26 from 2016, I implemented
> it in 2018. So is it older or newer than the one I tested against at the time?)
>
> I pulled up my old Ubuntu 0804 image to see what an OLD one would do, but the
> sort in that doesn't know -V exists. (<coulson>So that's what it
> does.</coulson>) And the Fedora image I installed a while back only booted the
> first time because qemu does this "you gave me a file to use as a hard drive but
> it's dangerous not to SAY it's a file to use as a hard drive with the
> extra-secret handshake so let's silently discard writes to the boot sector so
> whatever you install to it doesn't work, because obviously writing to every
> OTHER sector of the disk is NOT dangerous in any way! Heck, dd the whole thing
> with zeroes as long as you save that all-important block 0." Thanks for the
> "upgrade", QEMU devs! (And if you delete the multi-gigabyte iso you downloaded
> before noticing, and are on an airplane, it's a bit of a pain.)
>
> Anyway, TEST_HOST changed in sort.tests and I dunno if I should change toybox or
> just blame coreutils for being inconsistent? There's no spec, this is a feature
> the gnu devs hallucinated up without particularly documenting it that I can find...
>
> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net



More information about the Toybox mailing list