Skip to content

sort: reject incompatible modes across repeated --sort options - #15718

Open
kmehltretter82 wants to merge 1 commit into
uutils:mainfrom
kmehltretter82:fix/15596-sort-multiple-sort-modes
Open

kmehltretter82 wants to merge 1 commit into
uutils:mainfrom
kmehltretter82:fix/15596-sort-multiple-sort-modes

Conversation

@kmehltretter82

Copy link
Copy Markdown

--sort overrides earlier occurrences of itself in clap, so ModeFlags only sees the last --sort= value. Passing conflicting modes such as --sort=general-numeric --sort=human-numeric, or -h followed by --sort=general-numeric --sort=human-numeric, drops the earlier value and skips the incompatibility check.

Append --sort values in clap and collect every --sort occurrence in ModeFlags::from_matches. Repeated identical --sort values remain accepted, and conflicting modes now fail with "options '-...' are incompatible".

Closes #15596

Comment thread src/uu/sort/src/sort.rs Outdated
@kmehltretter82
kmehltretter82 force-pushed the fix/15596-sort-multiple-sort-modes branch 2 times, most recently from cb98531 to 471cecf Compare October 24, 2026 21:50
@codspeed

codspeed Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning, 1 note

⚠️ 28 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

ℹ️ 1 benchmark has no flamegraph

The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

See affected benchmarks

✅ 58 untouched benchmarks
⏩ 414 skipped benchmarks1


Comparing kmehltretter82:fix/15596-sort-multiple-sort-modes (96063d1) with main (1d6ca65)2

Open in CodSpeed

Footnotes

  1. 414 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 (e90b788) during the generation of this report, so 1d6ca65 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

--sort overrides earlier occurrences of itself in clap, so ModeFlags
only sees the last --sort=<WORD> value. Passing conflicting modes such
as --sort=general-numeric --sort=human-numeric, or -h followed by
--sort=general-numeric --sort=human-numeric, drops the earlier value
and skips the incompatibility check.

Append --sort values in clap and collect every --sort occurrence in
ModeFlags::from_matches. Repeated identical --sort values remain
accepted, and conflicting modes now fail with "options '-...' are
incompatible".

Closes uutils#15596
@kmehltretter82
kmehltretter82 force-pushed the fix/15596-sort-multiple-sort-modes branch from 471cecf to 96063d1 Compare October 25, 2026 19:44

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.

bug(sort): error "options -gh are incompatible" is bypassable

2 participants