Skip to content

uucore: version_cmp: compare endings when stems tie as versions - #15851

Open
vibhuthespeedst wants to merge 1 commit into
uutils:mainfrom
vibhuthespeedst:version-cmp-keep-endings-on-tie
Open

vibhuthespeedst wants to merge 1 commit into
uutils:mainfrom
vibhuthespeedst:version-cmp-keep-endings-on-tie

Conversation

@vibhuthespeedst

Copy link
Copy Markdown

Fixes #15795

version_cmp only put the file endings back when the stems were byte-identical. Stems like tool-1.00 and tool-1.0 tie as versions but not as bytes, so the endings were never compared and sort -V -u dropped one of the lines.

The endings are now also kept when the stems compare equal as versions, which matches the rule in the GNU manual.

Added a unit test with the pairs from the issue, plus a sort -V -u test.

Endings were only compared when the stems were byte-identical, so
tool-1.00.txt and tool-1.0.exe compared Equal and sort -V -u dropped
one of them.

Fixes uutils#15795

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sort -V -u drops lines differing only in leading zeros and extension

1 participant