Skip to content

uucore: stop option parsing at first operand when POSIXLY_CORRECT is set - #14659

Open
krosci wants to merge 1 commit into
uutils:mainfrom
krosci:fix/posixly-correct-arg-parsing
Open

krosci wants to merge 1 commit into
uutils:mainfrom
krosci:fix/posixly-correct-arg-parsing

Conversation

@krosci

@krosci krosci commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

When POSIXLY_CORRECT is present in the environment, option processing must stop at the first non-option argument, treating all subsequent arguments as operands. This patch introduces argument preparation in uucore's clap localization and argument parsing entry points to insert the end-of-options separator before the first positional operand while preserving GNU compatibility for join and pr. Comprehensive unit and integration tests have been added across utilities to prevent regression.

Fixes #14621

@codspeed

codspeed Bot commented Sep 17, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 13.72%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 2 regressed benchmarks
✅ 365 untouched benchmarks
⏩ 50 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation rm_single_file 105.1 ms 135.5 ms -22.44%
Simulation factor_multiple_u64s[2] 68.3 ms 71.1 ms -4.01%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing krosci:fix/posixly-correct-arg-parsing (8a8664d) with main (b60091b)2

Open in CodSpeed

Footnotes

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

@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/tail/retry (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tty-eof (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/unexpand/bounded-memory is now passing!

@krosci
krosci force-pushed the fix/posixly-correct-arg-parsing branch from 504c205 to 8a8664d Compare September 18, 2026 12:49
k == ContextKind::InvalidArg && v == &ContextValue::String("[template]".into())
}) =>
{
UUsageError::new(1, translate!("mktemp-error-too-many-templates"))

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.

Why ?

@anastygnome

Copy link
Copy Markdown
Contributor

The perf regression is due to checking the envvar, nothing that we can avoid, sadly.

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.

POSIXLY_CORRECT is ignored for option parsing: options after operands are still parsed

2 participants