proposal: consolidate `libc::mode_t` abstraction
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
I was hacking on #7728, trying to get rid of numerous suspiscious u32 casts, and realized that many of them have to do with libc::mode_t alias. In most unix-like OS, it uses u32, but some use u16 and Redux uses i32, making this somewhat problematic.
Coreutils code constantly casts from mode_t to u32 and back. I think a better paradigm might be to introduce a dedicated type, probably based on bitflags? In general, a strongly typed flag type should be better than a generic u32 passed around. My only reservation is that maybe this should be part of libc itself?
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 reading issue #7728, the libc::mode_t documentation, and the linked libc discussion #4404. Then inventory the existing mode_t-to-u32 casts in the coreutils codebase and determine whether a dedicated bitflags-based type belongs here or in libc. Done means an agreed design and a consistent abstraction that handles the differing Unix-like representations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, operating-systems
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100