Skip to content

[sort] -V comparator case-folds non-digit fields and ignores tilde rule (not GNU version order) #1340

Closed

Description

@caomengxuan666

Summary

sort -V (version sort) is not GNU's version comparison: non-digit runs are compared case-insensitively and ~ has no special (sorts-before-everything) meaning.

Evidence (harness vs GNU, two runs)

  • Input lines a1, B1 with sort -V:
    • GNU: B1 before a1 (byte order for the non-digit prefix).
    • WinuxCmd: a1 before B1 (case-folded comparison).
  • Input 1.0~rc1, 1.0: GNU orders 1.0~rc1 first (~ sorts before end-of-string). WinuxCmd orders 1.0 first (the comparator at sort.cpp ~L314-357 lowercases letters and has no tilde rule).

Regression seed

  • Both orderings → expect GNU's.

Found by the full-audit.

Activity

  1. added
    bug
    compat-gap
    on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugcompat-gap

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions