coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

Add legacy +POS/-POS handling in sort to pass GNU sort-field-limit test

Open karanabe opened this issue 1 month ago • 2 comments

This change translates GNU’s legacy +POS1 [-POS2] sort key syntax into -k form before clap parsing, gating it by _POSIX2_VERSION to match GNU behavior, and adds by-util tests to ensure acceptance/rejection behavior matches GNU and that the sort-field-limit compatibility test passes.

#9127

karanabe avatar Nov 27 '25 23:11 karanabe

GNU testsuite comparison:

Congrats! The gnu test tests/sort/sort-field-limit is no longer failing!

github-actions[bot] avatar Nov 27 '25 23:11 github-actions[bot]

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/sort/sort-field-limit is no longer failing!

github-actions[bot] avatar Dec 01 '25 17:12 github-actions[bot]

CodSpeed Performance Report

Merging #9501 will degrade performances by 4.51%

Comparing karanabe:test/fix-sort-field-limit (a10c06e) with main (64203e3)

Summary

⚡ 1 improvement
❌ 2 regressions
✅ 124 untouched
⏩ 6 skipped[^skipped]

:warning: Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
sort_ascii_c_locale 21.6 ms 22.6 ms -4.51%
sort_numeric 24 ms 23.5 ms +2.04%
tsort_input_parsing_heavy[5000] 82.1 ms 83.8 ms -2.04%
[^skipped]: 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

codspeed-hq[bot] avatar Dec 14 '25 07:12 codspeed-hq[bot]

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/sort/sort-field-limit is no longer failing!

github-actions[bot] avatar Dec 14 '25 07:12 github-actions[bot]

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/sort/sort-field-limit is no longer failing!

github-actions[bot] avatar Dec 14 '25 08:12 github-actions[bot]

@cakebaker Thanks for the review! I've addressed all the comments. Regarding the test failure, test_tail::test_retry6 stdout does not seem to be related to this change and appears to be failing elsewhere as well. Could you please take another look?

karanabe avatar Dec 14 '25 11:12 karanabe

Congrats! The gnu test tests/sort/sort-field-limit is no longer failing!

Kudos, thanks!

cakebaker avatar Dec 15 '25 09:12 cakebaker