uutils / uutils/coreutils

rm doesn't really traverse directories like GNU rm at all, will fail on deeply-nested paths

Open
#2,949 8 comments 4 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

GNU rm avoids constructing path strings of unbounded length to allow recursively deleting directories whose absolute paths exceed the max path length a Linux syscall can take. For more information please refer to this blogpost I wrote a while ago: https://unterwaditzer.net/2021/linux-paths.html

The rm in this repo appears to construct Path objects and therefore almost certainly will fail to remove the nested directories constructed in that article.

IIRC BSD rm works similarly to GNU rm here, and I would not be surprised if POSIX mandates a solution that works on really deeply nested filepaths.

There's probably more utilities in this repo which use Path objects, which immediately makes them fail in those edgecase situations where the equivalent GNU version might not.

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 by reading the repository's rm implementation and reproducing the deeply nested path case described in the linked blog post. Compare its Path-based traversal with GNU or BSD rm behavior; done means rm can delete paths exceeding a Linux syscall's maximum path length without constructing unbounded path strings.

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
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.