Skip to content

ls: honor LC_TIME for --time-style=locale#11669

Open
sylvestre wants to merge 4 commits intouutils:mainfrom
sylvestre:time-style_locale
Open

ls: honor LC_TIME for --time-style=locale#11669
sylvestre wants to merge 4 commits intouutils:mainfrom
sylvestre:time-style_locale

Conversation

@sylvestre
Copy link
Copy Markdown
Contributor

@sylvestre sylvestre commented Apr 5, 2026

on my system

$ export L="en_US fr_FR ru_RU.KOI8-R fa_IR.UTF-8 am_ET.UTF-8 th_TH.UTF-8 zh_CN.GB18030"; for f in $L; do echo "$f:"; LANG=$f cargo run -q --features unix -- ls -al --time-style=locale Cargo.toml LICENSE; done
en_US:
-rw-rw-r--+  1 sylvestre sylvestre 27798 Apr  5 22:05 Cargo.toml
-rw-r--r--+  1 sylvestre sylvestre  1056 Mar 20  2025 LICENSE
fr_FR:
-rw-rw-r--+  1 sylvestre sylvestre 27798 avr  5 22:05 Cargo.toml
-rw-r--r--+  1 sylvestre sylvestre  1056 mars 20  2025 LICENSE
ru_RU.KOI8-R:
-rw-rw-r--+  1 sylvestre sylvestre 27798 апр  5 22:05 Cargo.toml
-rw-r--r--+  1 sylvestre sylvestre  1056 март 20  2025 LICENSE
fa_IR.UTF-8:
-rw-rw-r--+  1 sylvestre sylvestre 27798 فروردین 16 22:05 Cargo.toml
-rw-r--r--+  1 sylvestre sylvestre  1056 اسفند 30  1403 LICENSE
am_ET.UTF-8:
-rw-rw-r--+  1 sylvestre sylvestre 27798 ኤፕሪ 27 22:05 Cargo.toml
-rw-r--r--+  1 sylvestre sylvestre  1056 ማርች 11  2017 LICENSE
th_TH.UTF-8:
-rw-rw-r--+  1 sylvestre sylvestre 27798 เม.ย  5 22:05 Cargo.toml
-rw-r--r--+  1 sylvestre sylvestre  1056 มี.ค 20  2568 LICENSE
zh_CN.GB18030:
-rw-rw-r--+  1 sylvestre sylvestre 27798 4月  5 22:05 Cargo.toml
-rw-r--r--+  1 sylvestre sylvestre  1056 3月 20  2025 LICENSE

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

GNU testsuite comparison:

GNU test failed: tests/ls/abmon-align. tests/ls/abmon-align is passing on 'main'. Maybe you have to rebase?
Congrats! The gnu test tests/seq/seq-epipe is now passing!

@sylvestre sylvestre requested a review from cakebaker April 5, 2026 22:02
@sylvestre
Copy link
Copy Markdown
Contributor Author

GNU test failed: tests/ls/abmon-align. tests/ls/abmon-align is passing on 'main'. Maybe you have to rebase?

looking at this

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

GNU testsuite comparison:

GNU test failed: tests/date/date-thailand. tests/date/date-thailand is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/basenc/bounded-memory is now being skipped but was previously passing.
Note: The gnu test tests/expand/bounded-memory is now being skipped but was previously passing.
Congrats! The gnu test tests/cut/cut-huge-range is now passing!

@sylvestre sylvestre force-pushed the time-style_locale branch from e28448c to c302650 Compare April 6, 2026 08:10
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

GNU testsuite comparison:

GNU test failed: tests/date/date-thailand. tests/date/date-thailand is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/follow-name (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cut/cut-huge-range is now passing!

@sylvestre sylvestre force-pushed the time-style_locale branch from c302650 to 7856aaf Compare April 6, 2026 09:12
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/pr/bounded-memory is now passing!
Congrats! The gnu test tests/seq/seq-epipe is now passing!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/follow-name (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/pr/bounded-memory is now passing!

@sylvestre sylvestre marked this pull request as ready for review April 6, 2026 11:39
@LevitatingBusinessMan
Copy link
Copy Markdown
Contributor

You picked this issue up fast :D

@sylvestre sylvestre force-pushed the time-style_locale branch from 0a9df65 to 893c2ae Compare April 6, 2026 13:48
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)

@sylvestre
Copy link
Copy Markdown
Contributor Author

@cakebaker
spoiler! After this one, i have --quoting-style=locale/clocale built on top :)

Comment thread tests/by-util/test_ls.rs Outdated
Comment thread tests/by-util/test_ls.rs Outdated
Comment thread tests/by-util/test_ls.rs Outdated
@cakebaker
Copy link
Copy Markdown
Contributor

I will finish the review of test_ls.rs and the two uucore files (hopefully) tomorrow.

Comment thread tests/by-util/test_ls.rs Outdated
Comment thread tests/by-util/test_ls.rs Outdated
Comment thread src/uucore/src/lib/features/i18n/datetime.rs
@sylvestre sylvestre force-pushed the time-style_locale branch from 893c2ae to 36be3f5 Compare April 8, 2026 09:47
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/printf/printf-surprise is now passing!

Comment thread src/uucore/src/lib/features/i18n/datetime.rs
@cakebaker
Copy link
Copy Markdown
Contributor

cakebaker commented Apr 8, 2026

Hm, it looks like one of my previous suggestions doesn't work on OpenBSD as test_ls_abmon_align fails :|

@sylvestre sylvestre force-pushed the time-style_locale branch from 36be3f5 to 4486cc1 Compare April 9, 2026 09:42
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tty/tty-eof (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/cp/link-heap is now passing!
Congrats! The gnu test tests/dd/no-allocate is now passing!
Congrats! The gnu test tests/seq/seq-epipe is now passing!

Add format_system_time_locale_aware in uucore::time that runs the
format string through i18n::datetime::localize_format_string when a
non-C LC_TIME locale is active, and route ls's display_date through
it. Fixes month names and alternate-calendar years (Persian,
Buddhist, Ethiopian) matching GNU. Also generalize uutests'
is_locale_available to derive the expected charmap from the locale
suffix so non-UTF-8 locales work, and consolidate the ls locale
tests into a single data-driven case.
@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/symlink (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/basenc/bounded-memory is now passing!

The ls-specific column alignment padding (from abmon-align) was leaking
into date output. Add a `pad` parameter to `localize_format_string` so
ls gets padded names and date gets raw names.
@github-actions
Copy link
Copy Markdown

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 155.65 MB (+3.05 MB, +2.00%)

Significant per-binary changes:
  dir      2.08 MB ->    3.09 MB  (+1.01 MB, +48.68%)
  ls       2.08 MB ->    3.09 MB  (+1.01 MB, +48.68%)
  vdir     2.08 MB ->    3.09 MB  (+1.01 MB, +48.68%)

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/tail/tail-n0f (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/basenc/bounded-memory is now passing!

@sylvestre
Copy link
Copy Markdown
Contributor Author

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 155.65 MB (+3.05 MB, +2.00%)

Significant per-binary changes:
  dir      2.08 MB ->    3.09 MB  (+1.01 MB, +48.68%)
  ls       2.08 MB ->    3.09 MB  (+1.01 MB, +48.68%)
  vdir     2.08 MB ->    3.09 MB  (+1.01 MB, +48.68%)

nice, it works (and it is expected)

@github-actions
Copy link
Copy Markdown

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 155.65 MB (+3.05 MB, +2.00%)

Significant per-binary changes:
  dir      2.08 MB ->    3.09 MB  (+1.01 MB, +48.68%)
  ls       2.08 MB ->    3.09 MB  (+1.01 MB, +48.68%)
  vdir     2.08 MB ->    3.09 MB  (+1.01 MB, +48.68%)

@sylvestre sylvestre requested a review from cakebaker April 12, 2026 15:47
@LevitatingBusinessMan
Copy link
Copy Markdown
Contributor

where did that megabyte come from

@sylvestre
Copy link
Copy Markdown
Contributor Author

Datetime. In the db of translations

@LevitatingBusinessMan
Copy link
Copy Markdown
Contributor

Aren't the translations taken from the system?

@sylvestre
Copy link
Copy Markdown
Contributor Author

@cakebaker ok ? :)
thanks

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.

3 participants