Skip to content

sort: reject --batch-size arguments above the fd soft limit - #14033

Merged
sylvestre merged 1 commit into
uutils:mainfrom
sylvestre:fix-gnu-sort-fdlimit
Aug 20, 2026
Merged

sort: reject --batch-size arguments above the fd soft limit#14033
sylvestre merged 1 commit into
uutils:mainfrom
sylvestre:fix-gnu-sort-fdlimit

Conversation

@sylvestre

Copy link
Copy Markdown
Contributor

sort only validated --batch-size against the file descriptor rlimit when the argument did not even fit in a usize. A value such as 20 with a soft limit of 19 was silently accepted, while GNU sort exits with status 2 and reports the maximum usable value.

Compare the parsed value with the soft limit minus the three descriptors that are always taken by stdin, stdout and stderr, and reuse the existing "too large"/"maximum --batch-size argument with current rlimit" messages for both the overflow and the out-of-range cases.

PR #11961 (deduplicating file descriptors during merge) targets a different part of the problem and does not touch this validation.

Should make test tests/sort/sort-merge-fdlimit.sh pass #11961
#13841

Copilot AI lite review requested due to automatic review settings August 19, 2026 17:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

sort only validated --batch-size against the file descriptor rlimit when
the argument did not even fit in a usize.  A value such as 20 with a soft
limit of 19 was silently accepted, while GNU sort exits with status 2 and
reports the maximum usable value.

Compare the parsed value with the soft limit minus the three descriptors
that are always taken by stdin, stdout and stderr, and reuse the existing
"too large"/"maximum --batch-size argument with current rlimit" messages
for both the overflow and the out-of-range cases.

PR uutils#11961 (deduplicating file descriptors during merge) targets a
different part of the problem and does not touch this validation.

Should make test tests/sort/sort-merge-fdlimit.sh pass
uutils#11961
uutils#13841
@sylvestre
sylvestre force-pushed the fix-gnu-sort-fdlimit branch from 1d06bfb to fe188b0 Compare August 20, 2026 06:17
Copilot AI review requested due to automatic review settings August 20, 2026 06:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/misc/io-errors (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/sort/sort-merge-fdlimit is no longer failing!

@codspeed-hq

codspeed-hq Bot commented Aug 20, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 8.44%

⚡ 9 improved benchmarks
✅ 348 untouched benchmarks
⏩ 50 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation numfmt_stream_to_si 414.1 ms 291.6 ms +42.01%
Simulation numfmt_from_si[10000] 83.3 ms 75.7 ms +10.09%
Simulation numfmt_stream_to_si_precision 346.4 ms 330.1 ms +4.93%
Simulation numfmt_to_si[10000] 90 ms 86.4 ms +4.11%
Simulation numfmt_round_modes[("up", 10000)] 90.9 ms 87.3 ms +4.06%
Simulation numfmt_padding[(10000, 50)] 95.8 ms 92.1 ms +4.01%
Simulation numfmt_round_modes[("towards-zero", 10000)] 91 ms 87.5 ms +3.97%
Simulation numfmt_round_modes[("down", 10000)] 91.3 ms 87.9 ms +3.95%
Simulation numfmt_large_numbers_si[10000] 96.7 ms 93.2 ms +3.83%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing sylvestre:fix-gnu-sort-fdlimit (fe188b0) with main (b2a617e)2

Open in CodSpeed

Footnotes

  1. 50 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.

  2. No successful run was found on main (8fe6e9e) during the generation of this report, so b2a617e was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@sylvestre
sylvestre merged commit aa35e35 into uutils:main Aug 20, 2026
169 checks passed
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.

2 participants