Skip to content

Conversation

@CrazyRoka
Copy link
Contributor

Previously, applying flags like '^' (uppercase) or '#' (swap case) to locale-dependent specifiers (like %c, %x, %X) failed to affect the output. This occurred because the implementation passed these specifiers directly to the underlying formatter, which treats %c as a single unit without inheriting flags for its expanded components.

For example, LC_ALL=C TZ=UTC cargo run --bin coreutils date -d 2024-01-01 +%^c produced "2024 M01 1, Mon 00:00:00", whereas GNU date produces "MON JAN 1 00:00:00 2024".

This change pre-processes the format string to expand %c, %x, and %X using nl_langinfo.

This aligns behavior with GNU coreutils and we are now passing subfmt-up1 edge case in tests/date/date.pl

@CrazyRoka CrazyRoka force-pushed the date-implement-locale-specific branch from 230c85d to 3654036 Compare December 28, 2025 23:31
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@sylvestre
Copy link
Contributor

lot of jobs are failing

@CrazyRoka CrazyRoka force-pushed the date-implement-locale-specific branch from 3654036 to bf1c296 Compare December 29, 2025 11:15
@CrazyRoka CrazyRoka force-pushed the date-implement-locale-specific branch from bf1c296 to f494fa5 Compare December 29, 2025 11:27
@github-actions
Copy link

GNU testsuite comparison:

Note: The gnu test tests/id/smack was skipped on 'main' but is now failing.
Note: The gnu test tests/mkdir/smack-no-root was skipped on 'main' but is now failing.
Note: The gnu test tests/mkdir/smack-root was skipped on 'main' but is now failing.

- Add documentation for distribute_flag helper.
- Add unit tests for flag distribution and locale expansion.
- Add integration test for locale expansion with uppercase flag.
@CrazyRoka CrazyRoka force-pushed the date-implement-locale-specific branch from 65b15f3 to 49f0f26 Compare December 31, 2025 20:41
@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/tty/tty-eof. tests/tty/tty-eof is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants