Skip to content

Conversation

@nekluu
Copy link

@nekluu nekluu commented Jan 17, 2026

Description

This PR addresses a TODO in copy_direntry regarding error handling during directory traversal.

Currently, if a file is missing (e.g., deleted by another process) during a copy operation, cp terminates immediately. This change allows cp to show a warning and continue with the remaining files when a NotFound error occurs, consistent with how PermissionDenied is handled.

Changes

  • Added a match arm for io::ErrorKind::NotFound in copy_direntry.
  • Ensured the process continues instead of returning an Err early.

Related Issue

Addresses the TODO comment in src/uu/cp/src/copydir.rs.

@Ecordonnier
Copy link
Collaborator

"Related Issue
Addresses the TODO comment in src/uu/cp/src/cp.rs."

-> what do you mean? The TODO this PR addresses is in copydir.rs, not in cp.rs.

Also since this PR addresses the TODO, can the TODO now be removed?

@Ecordonnier Ecordonnier self-assigned this Jan 18, 2026
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/shuf/shuf-reservoir (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/sort/sort-stale-thread-mem (passes in this run but fails in the 'main' branch)

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 18, 2026

Merging this PR will degrade performance by 26.25%

❌ 7 regressed benchmarks
✅ 275 untouched benchmarks
⏩ 38 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory sort_mixed_data[500000] 22.5 MB 27.2 MB -17.15%
Memory sort_ascii_only[500000] 22.2 MB 28.3 MB -21.74%
Memory sort_long_line[160000] 724.4 KB 982.3 KB -26.25%
Memory sort_accented_data[500000] 22.1 MB 28.3 MB -21.78%
Memory sort_key_field[500000] 45.8 MB 51.8 MB -11.46%
Memory cp_large_file[16] 107.6 KB 116.9 KB -8%
Simulation cp_large_file[16] 369.8 µs 383.3 µs -3.52%

Comparing nekluu:main (9ad27a2) with main (799de29)

Open in CodSpeed

Footnotes

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

@nekluu
Copy link
Author

nekluu commented Jan 18, 2026

"Related Issue Addresses the TODO comment in src/uu/cp/src/cp.rs."

-> what do you mean? The TODO this PR addresses is in copydir.rs, not in cp.rs.

Also since this PR addresses the TODO, can the TODO now be removed?

I apologize, I wrote the file path incorrectly. My mistake. I keep the TODO because I thought you might want to support other error types in the future. If you think no further error support is needed, we can remove the TODO.

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