cp: fix --remove-destination deleting source when dest is the same file under a different path#13135
cp: fix --remove-destination deleting source when dest is the same file under a different path#13135LoukasPap wants to merge 1 commit into
Conversation
Merging this PR will degrade performance by 39.23%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | cp_recursive_deep_tree[(120, 4)] |
13 ms | 40.8 ms | -68.06% |
| ❌ | Simulation | cp_recursive_balanced_tree[(5, 4, 10)] |
70.5 ms | 102.1 ms | -30.9% |
| ❌ | Simulation | cp_preserve_metadata[(5, 4, 10)] |
73.5 ms | 105.5 ms | -30.32% |
| ❌ | Simulation | cp_archive_balanced_tree[(5, 4, 10)] |
76.8 ms | 108.3 ms | -29.11% |
| ❌ | Simulation | cp_recursive_wide_tree[(6000, 800)] |
184.1 ms | 242.3 ms | -24% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing LoukasPap:issue13103 (eadcff4) with main (e73b8a6)
Footnotes
-
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. ↩
|
GNU testsuite comparison: |
|
Is there a way to test the performance locally or before pushing? |
…le under a different path
|
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. |
Fixes #13103
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.