Skip to content

cut: don't rewrite a -d= file operand after -- - #15822

Open
sarankumar1325 wants to merge 1 commit into
uutils:mainfrom
sarankumar1325:fix/cut-equals-delimiter-after-double-dash
Open

sarankumar1325 wants to merge 1 commit into
uutils:mainfrom
sarankumar1325:fix/cut-equals-delimiter-after-double-dash

Conversation

@sarankumar1325

Copy link
Copy Markdown
Contributor

Fixes #15806.

uumain rewrites a raw -d= argument to --delimiter== before clap parses the command line, so GNU's cut -d= works. It did this for every argument, including file operands after --, so cut -d: -f2 -- -d= opened --delimiter== instead of -d= (or failed with No such file or directory).

The rewrite now stops once -- has been seen.

Tests

  • New test_equal_delimiter_file_operand_after_double_dash: creates both -d= and --delimiter== and checks that cut -d: -f2 -- -d= reads -d=. 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_cut -- -D warnings are clean.

The issue notes that sort's -t rewrite has the same problem; I've sent that as a separate small PR.

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

A file operand named `-d=` after `--` was rewritten to `--delimiter==`
before clap parsing, so cut opened the wrong file. Stop the rewrite once
`--` has been seen.

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

cut: opens the wrong file because -d= is rewritten even after --

2 participants