factor out POSIX locale-str parsing
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
I've noticed code duplication w.r.t. locale env-vars (LANG, LC_*), and one instance of a bug caused by improper parsing
This function seems to work properly, but because POSIX isn't very clear, it might be incorrect as it matches the POSIX/C locale against the full string, instead of splitting on ".".
This fn is very similar to the previous one.
Then there's this other fn which performs full locale parsing, but seems to incorrectly handle malformed strings such as en_us@utf-8.dict
I was considering to implement a new crate for locale parsing, as I couldn't find one on crates.io. This way, uutils and other projects could benefit from consistent parsing
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
Compare the locale handling in src/cmp.rs, uu/uniq/src/uniq.rs, and uucore/src/lib/features/i18n/mod.rs, focusing on POSIX/C matching, splitting on ".", and malformed values such as en_us@utf-8.dict. Define the shared parsing behavior and verify that uutils and related consumers can use it consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, internationalization
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100