Skip to content

sort: reject -o combined with --debug - #16020

Open
Logic769 wants to merge 3 commits into
uutils:mainfrom
Logic769:sort-debug-output-incompatible
Open

Logic769 wants to merge 3 commits into
uutils:mainfrom
Logic769:sort-debug-output-incompatible

Conversation

@Logic769

Copy link
Copy Markdown
Contributor

Problem

sort -o out --debug succeeds, writes out and prints its debug notes, whereas GNU sort rejects this combination:

sort: options '-o --debug' are incompatible
(exit code 2)

Change

Reject the combination of -o/--output and --debug before any output is written, with exit code 2.

Tests

Added test_debug_incompatible_with_output in tests/by-util/test_sort.rs, which checks the exit code, the error message and that no output file is created.

Closes #15998

@Logic769
Logic769 force-pushed the sort-debug-output-incompatible branch from 2db6fec to 516e53e Compare October 30, 2026 13:03
Comment thread src/uu/sort/locales/en-US.ftl Resolved
Comment thread src/uu/sort/src/sort.rs Resolved
Comment thread src/uu/sort/src/sort.rs Resolved
Comment thread tests/by-util/test_sort.rs Resolved
@Logic769
Logic769 force-pushed the sort-debug-output-incompatible branch from 516e53e to b14a761 Compare October 31, 2026 02:47
@Logic769

Copy link
Copy Markdown
Contributor Author

Moved the check next to the -co one and used incompatible_options_error("o --debug"), so the ftl string and the variant are gone. The test asserts fails_with_code(2) and stderr_only("sort: options '-o --debug' are incompatible\n").

@codspeed

codspeed Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning, 1 note

⚠️ 29 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 Logic769:sort-debug-output-incompatible (d9dddef) with main (c5ce288)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 (36a00ef) during the generation of this report, so c5ce288 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@sylvestre

Copy link
Copy Markdown
Contributor

lot of jobs are failing
please monitor this for all your PR

@Logic769
Logic769 force-pushed the sort-debug-output-incompatible branch from b14a761 to 0f1e7b7 Compare November 2, 2026 01:02
Comment thread src/uu/sort/src/sort.rs Resolved
Comment thread src/uu/sort/src/sort.rs Resolved
@sylvestre

Copy link
Copy Markdown
Contributor

a bunch of jobs are failing

@Logic769
Logic769 force-pushed the sort-debug-output-incompatible branch from 244d379 to d9dddef Compare November 3, 2026 15:43

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.

sort: -o and --debug should be incompatible

2 participants