mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
sort/ls: implement version cmp matching GNU spec
This reimplements version_cmp, which is used in sort and ls to sort according to versions. However, it is not bug-for-bug identical with GNU's implementation. I reported a bug with GNU here: https://lists.gnu.org/archive/html/bug-coreutils/2021-06/msg00045.html This implementation does not contain the bugs regarding the handling of file extensions and null bytes.
This commit is contained in:
parent
5fce7ecbaa
commit
233a778963
12 changed files with 423 additions and 360 deletions
|
@ -8,4 +8,8 @@
|
|||
1.2.3-alpha
|
||||
1.2.3-alpha2
|
||||
11.2.3
|
||||
bar2
|
||||
bar2.0.0
|
||||
foo0.1
|
||||
foo1.0
|
||||
1.12.4
|
||||
|
|
45
tests/fixtures/sort/version-empty-lines.expected.debug
vendored
Normal file
45
tests/fixtures/sort/version-empty-lines.expected.debug
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
|
||||
^ no match for key
|
||||
^ no match for key
|
||||
|
||||
^ no match for key
|
||||
^ no match for key
|
||||
|
||||
^ no match for key
|
||||
^ no match for key
|
||||
|
||||
^ no match for key
|
||||
^ no match for key
|
||||
|
||||
^ no match for key
|
||||
^ no match for key
|
||||
|
||||
^ no match for key
|
||||
^ no match for key
|
||||
|
||||
^ no match for key
|
||||
^ no match for key
|
||||
1.2.3-alpha
|
||||
___________
|
||||
___________
|
||||
1.2.3-alpha2
|
||||
____________
|
||||
____________
|
||||
11.2.3
|
||||
______
|
||||
______
|
||||
bar2
|
||||
____
|
||||
____
|
||||
bar2.0.0
|
||||
________
|
||||
________
|
||||
foo0.1
|
||||
______
|
||||
______
|
||||
foo1.0
|
||||
______
|
||||
______
|
||||
>>>1.12.4
|
||||
_________
|
||||
_________
|
4
tests/fixtures/sort/version-empty-lines.txt
vendored
4
tests/fixtures/sort/version-empty-lines.txt
vendored
|
@ -9,3 +9,7 @@
|
|||
|
||||
|
||||
1.12.4
|
||||
foo1.0
|
||||
foo0.1
|
||||
bar2.0.0
|
||||
bar2
|
Loading…
Add table
Add a link
Reference in a new issue