uutils / uutils/coreutils

rm is unable to delete deep directory structure

Open
#7,375 4 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

$ ~/.cargo/bin/coreutils
coreutils 0.0.29 (multi-call binary)
$ (for i in `seq 1 2000`; do mkdir 1234567890123456789012345678901234567890; cd 1234567890123456789012345678901234567890; done)
$ ~/.cargo/bin/coreutils rm -rf 1234567890123456789012345678901234567890
rm: cannot remove '1234567890123456789012345678901234567890': Too many open files (os error 24)

I'm not sure if this is the same problem - #5714 ?

(for comparison - gnu coreutils deals with this just fine:

$ /bin/rm -rf 1234567890123456789012345678901234567890
$ ls -ld 1234567890123456789012345678901234567890
ls: cannot access '1234567890123456789012345678901234567890': No such file or directory

)

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 command entry point and reproduce the nested-directory command shown in the issue, then trace how recursive deletion keeps directories open. Compare the behavior with GNU rm and verify that rm -rf removes the 2,000-level structure without returning Too many open files.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.