Skip to content

fix(cp): remove overrides_with_all from flag group#13258

Open
BAMF0 wants to merge 1 commit into
uutils:mainfrom
BAMF0:bamf0/13207-cp-archive-deref-recursive
Open

fix(cp): remove overrides_with_all from flag group#13258
BAMF0 wants to merge 1 commit into
uutils:mainfrom
BAMF0:bamf0/13207-cp-archive-deref-recursive

Conversation

@BAMF0

@BAMF0 BAMF0 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

The -a / -L / -H / -P / -d flags form a mutual-exclusion group for symlink handling. Previously, clap's overrides_with_all handled precedence by stripping earlier flags. However, -a is a composite flag
(-dR --preserve=all), and stripping it wholesale loses recursive and --preserve=all.

Fix: remove overrides_with_all from all five flags. All coexist in the clap match. Precedence is now handled in overriding_order:

  • Add DEREFERENCE, NO_DEREFERENCE, CLI_SYMBOLIC_LINKS to the order
  • Derive both dereference and cli_dereference from the last flag in the mutual-exclusion group

Fixes: #13207

Also fixes:

  • -dL: no longer loses Attributes::LINKS
  • -aH: dereference correctly respects last-flag-wins

@BAMF0

BAMF0 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

CI discovered some errors, I'll fix the test and linting failures

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/retry (passes in this run but fails in the 'main' branch)

The -a/-L/-H/-P/-d flags form a mutual-exclusion group for symlink
handling. Previously, claps overrides_with_all handled precedence by
stripping earlier flags. However, -a is a composite flag (-dR
--preserve=all), and stripping it wholesale loses recursive and
--preserve=all.

Fix: remove overrides_with_all from all five flags. All coexist in
the clap match. Precedence is now handled in overriding_order:
- Add DEREFERENCE, NO_DEREFERENCE, CLI_SYMBOLIC_LINKS to the order
- Derive both dereference and cli_dereference from the last flag
  in the mutual-exclusion group

Fixes: uutils#13207

Also fixes:
- -dL: no longer loses Attributes::LINKS
- -aH: dereference correctly respects last-flag-wins
@BAMF0 BAMF0 force-pushed the bamf0/13207-cp-archive-deref-recursive branch from 9da5396 to c83b92b Compare July 2, 2026 15:14
@codspeed-hq

codspeed-hq Bot commented Jul 2, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 4.84%

⚡ 1 improved benchmark
✅ 330 untouched benchmarks
⏩ 46 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation sort_ascii_utf8_locale 16.1 ms 15.4 ms +4.84%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing BAMF0:bamf0/13207-cp-archive-deref-recursive (c83b92b) with main (eae191c)

Open in CodSpeed

Footnotes

  1. 46 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.

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.

cp -afL fails with 'cp: -r not specified; omitting directory <dir-name>'

1 participant