Skip to content

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

Open
sylvestre wants to merge 1 commit into
uutils:mainfrom
sylvestre:fix-gnu-sort-fdlimit
Open

sort: reject --batch-size arguments above the fd soft limit#14033
sylvestre wants to merge 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

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

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