cp with backup is not able to replace an open .exe file
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
For an exe file a.exe in dest folder, cp with any of the backup options like
cp -v --backup=numbered src/a.exe dest/a.exe
fails with error
The process cannot access the file because it is being used by another process. (os error 32)
(If relevant, on OS Windows)
Normally such a file could be manually replaced if the destination file is renamed first. Since a backup is also put in the same directory, maybe cp could also make a backup by renaming the file rather than just copying it?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing cp -v --backup=numbered src/a.exe dest/a.exe on Windows while the destination executable is open. Trace the backup and replacement handling for the cp command, then verify that backup-enabled replacement succeeds and preserves the destination backup without the sharing-violation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100