uutils / uutils/coreutils

factor out POSIX locale-str parsing

Open
#12,291 0 comments 0 reactions 0 assignees View on GitHub

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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.