Skip to content

cp: fix --remove-destination deleting source when dest is the same file under a different path - #13135

Merged
cakebaker merged 1 commit into
uutils:mainfrom
LoukasPap:issue13103
Jul 1, 2026
Merged

cakebaker merged 1 commit into
uutils:mainfrom
LoukasPap:issue13103

Conversation

@LoukasPap

@LoukasPap LoukasPap commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #13103 (original) and #13144

Problem

It compared the source and destination inputs as passed, so for example "a" and "./a" were compared and were -of course- found different.

Solution

We convert them to absolute paths using canonicalize(...) and then perform the equality check.

@codspeed

codspeed Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 323 untouched benchmarks
⏩ 46 skipped benchmarks1


Comparing LoukasPap:issue13103 (070a2de) with main (e73b8a6)

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

@github-actions

github-actions Bot commented Jun 27, 2026 •

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/rm/isatty (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/misc/tty-eof (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout-group (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/basenc/bounded-memory is now passing!
Congrats! The gnu test tests/rm/many-dir-entries-vs-OOM is now passing!
Congrats! The gnu test tests/tail/tail-n0f is now passing!

@LoukasPap

LoukasPap commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Is there a way to test the performance locally or before pushing?

@LoukasPap

Copy link
Copy Markdown
Contributor Author

Changed order of conditions to allow same-file check to happen only when --remove-destination param is set, thus avoiding redundant comparison of source and dest.

@cakebaker
cakebaker merged commit bc3a413 into uutils:main Jul 1, 2026
189 of 190 checks passed
@cakebaker

Copy link
Copy Markdown
Contributor

Thanks!

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.

2 participants