is fs::remove_file() guaranteed to remove the symlink link?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Location
https://doc.rust-lang.org/stable/std/fs/fn.remove_file.html
Summary
The documentation for std::fs::remove_file() states:
Removes a file from the filesystem.
[...]
This function currently corresponds to the unlink function on Unix. On Windows, DeleteFile is used or CreateFileW and SetInformationByHandle for readonly files. Note that, this may change in the future.
As noted, the implementation details may changed in the future. It is not mentioned whether or not this removes the symlink link, or the target, or whether this is platform-specific.
At the moment, both unlink ^1 and DeleteFile ^2 remove the link, not the target. The popular symlink crate has been relying on this behaviour for over 8 years.
Is this behaviour part of the API contract?
> If the name referred to a symbolic link, the link is removed.
> If the path points to a symbolic link, the symbolic link is deleted, not the target.
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 with the std::fs::remove_file documentation linked in the issue and compare its stated Unix and Windows behavior with the referenced unlink and DeleteFile documentation. The work is done when the API contract clearly addresses symbolic links and any platform-specific behavior, with the wording agreed for the documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation, operating-systems
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100