Skip to content

fix(sort): reject leading '+' in numeric (-n) sort#12350

Open
leno23 wants to merge 1 commit into
uutils:mainfrom
leno23:fix/sort-numeric-reject-plus-10315
Open

fix(sort): reject leading '+' in numeric (-n) sort#12350
leno23 wants to merge 1 commit into
uutils:mainfrom
leno23:fix/sort-numeric-reject-plus-10315

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

  • GNU sort -n does not treat + as a number sign
  • Skip f64 fast-path parsing when a line begins with + after whitespace

Fixes #10315

Test plan

  • test_numeric_sort_rejects_leading_plus_sign

Made with Cursor

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/pipe-f (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/tail-n0f (passes in this run but fails in the 'main' branch)

GNU sort -n does not treat '+' as a number sign. Skip f64 parsing for
lines with a leading plus so they sort lexicographically like GNU.

Fixes uutils#10315
@leno23 leno23 force-pushed the fix/sort-numeric-reject-plus-10315 branch from 6fc6a33 to 3c80f3a Compare May 17, 2026 15:52
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: numeric sort (-n) incorrectly parses '+' as a number sign

1 participant