uutils / uutils/coreutils

`coreutils rm -f` fails with read-only files on Windows

Open
#5,823 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - rm
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

On Windows, the call to fs::remove_file fails if the file is read-only.

I think, when using the -f switch, the following snippet (adapted from the doc of the fs library) should be used

let mut perms = fs::metadata(path)?.permissions();
perms.set_readonly(false);
fs::set_permissions(path, perms)?;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the rm implementation and trace the -f path that calls fs::remove_file on Windows. Check the Rust fs metadata and permission operations shown in the issue, then verify that forced removal succeeds for read-only files without changing normal removal behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.