GNU bug report logs -
#35939
version sort is incorrect with hyphen-minus
Previous Next
Full log
View this message in rfc822 format
With GNU coreutils 8.30 under Debian/unstable, I get:
$ LC_ALL=C ls
ab-cd abb abe
$ LC_ALL=C ls -v
abb abe ab-cd
The hyphen-minus character should still be regarded as being less
than the letters (there are no digits, so both are expected to be
equivalent). The GNU coreutils manual says:
10.1.3 Sorting the output
-------------------------
[...]
‘-v’
‘--sort=version’
Sort by version name and number, lowest first. It behaves like a
default sort, except that each sequence of decimal digits is
treated numerically as an index/version number. (*Note Details
about version sort::.)
(which is exactly what I expect).
The "sort -V" command has the same issue.
Note: If I add two more files and compare with zsh:
zira% export LC_ALL=C
zira% ls
ab-cd ab10 ab2 abb abe
zira% ls -v
ab2 ab10 abb abe ab-cd
zira% echo *
ab-cd ab10 ab2 abb abe
zira% echo *(n)
ab-cd ab2 ab10 abb abe
one can see that zsh is correct, but Coreutils has an issue with the
hyphen-minus character.
--
Vincent Lefèvre <vincent <at> 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)
This bug report was last modified 5 years and 351 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.