Skip to content

sort -M Locale Month Parsing Gap #9715

Open

Description

@sylvestre

Component

sort

Description

uutils' sort -M only hardcodes recognition of English 3-letter months (JAN..DEC) and does not parse month abbreviations according to the LC_TIME/LC_ALL locale; GNU sort parses them using the locale's month table.

Test / Reproduction Steps

(A locale with non-English month abbreviations is required, such as de_DE.UTF-8.):
$ printf 'Mär\nJan\n' | LC_ALL=de_DE.UTF-8 sort -M
$ printf 'Mär\nJan\n' | LC_ALL=de_DE.UTF-8 ./target/release/coreutils sort -M
  • GNU: JAN comes first
  • uutils: JAN comes last

Impact

In non-LC_ALL=C/non-English environments, the -M sorting result is incorrect, and scripts relying on localized month text will fail.

Activity

  1. added
    J - Locale
    on Dec 19, 2025
  2. ChrisDryden commented on Dec 19, 2025

    @ChrisDryden
    Collaborator

    Related issue with months: #3123

    Also corresponds to GNU test tests/misc/sort-month

  3. ChrisDryden commented on Dec 19, 2025

    @ChrisDryden
    Collaborator

    @sylvestre one thing that would help with whoever takes this on is the alignment on the high level implementation approach?

    I did some prototyping to see how similar things are resolved and the high level approach was using the ICU4X library for getting the locale months. The library that appears to correspond with the data we need is icu_datetime using the use icu_datetime::provider::neo::{DatetimeNamesMonthGregorianV1, MonthNames}; Then the approach is in the i18n folder creating a new "Months" file that handles the parsing of the months using the time locale?

    Is that a high level approach that aligns with what you're thinking?

  4. ChrisDryden commented on Dec 19, 2025

    @ChrisDryden
    Collaborator

    This is the implementation using that approach: #9722

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions