Skip to content

sort: don't rewrite a -t<chars> file operand after -- - #15823

Open
sarankumar1325 wants to merge 1 commit into
uutils:mainfrom
sarankumar1325:fix/sort-separator-after-double-dash
Open

sarankumar1325 wants to merge 1 commit into
uutils:mainfrom
sarankumar1325:fix/sort-separator-after-double-dash

Conversation

@sarankumar1325

Copy link
Copy Markdown
Contributor

Follow-up to #15806, which mentions that sort has the same problem as cut.

uumain rewrites every attached -t<chars> argument to --field-separator=<chars> before clap parsing, so -t= keeps = as the separator. The rewrite also ran on file operands after --, so sort -- -t= treated -t= as a separator option instead of reading the file -t=.

The rewrite now stops once -- has been seen, the same as the cut fix in #15822.

Tests

  • New test_separator_like_file_operand_after_double_dash: sort -- -t= reads and sorts the file -t=. It fails on main and passes with this change.
  • cargo test --features "cut sort" --no-default-features --test tests: 317 passed.
  • cargo fmt --check and cargo clippy -p uu_sort -- -D warnings are clean.

I used an AI assistant while working on this; I reviewed the change and the tests myself.

The `-t<chars>` to `--field-separator=<chars>` rewrite ran on every
argument, including file operands after `--`, so `sort -- -t=` tried to
use `=` as a separator instead of reading the file `-t=`. Stop the
rewrite once `--` has been seen, as in cut (uutils#15806).
Copilot AI balanced review requested due to automatic review settings October 25, 2026 13:23

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 insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

This branch has not been deployed

No deployments
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