On 2019-06-26 12:25:26 -0600, Assaf Gordon wrote:
> "ls -v" and "sort -V" (coreutils' version sort) behaves differently than
> other implementations in regards to minus character:
> 
>     $ printf "%s\n" abb ab-cd | sort -V
>     abb
>     ab-cd
> 
>     $ v1="abb"
>     $ v2="ab-cd"
>     $ dpkg --compare-versions "$v1" lt "$v2" && printf "$v1\n$v2\n" || printf 
> "$v2\n$v1\n"
>     ab-cd
>     abb
> 
> If I understand correctly,
> The reason is that in Debian's version comparison algorithm [1], the minus
> character has a special meaning: it separates the "upstream version"
> part from the "debian revision" part.

Note that I'm not using "ls -v" to sort version numbers, just
filenames (which can contain integers in decimal notation).

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



Reply via email to