uutils/coreutils

date: strftime O modifier leaks as literal in C locale

Open

#11.656 aperta il 5 apr 2026

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)Rust (1852 fork)batch import
U - datefuzzinggood first issue

Metriche repository

Star
 (23.246 star)
Metriche merge PR
 (Merge medio 9g 14h) (216 PR mergiate in 30 g)

Descrizione

Summary

date leaks the strftime O modifier as literal text (e.g. %Om%om) while GNU strips it in C locale. The O modifier requests "alternative numeric symbols" and is a no-op under LC_ALL=C.

Found by a fuzz_date run.

Reproduction

$ LC_ALL=C TZ=UTC /usr/bin/date -d '2024-06-15' '+%Om-%Oy-%Ol'
06-24-12
$ echo $?
0

$ LC_ALL=C TZ=UTC target/debug/coreutils date -d '2024-06-15' '+%Om-%Oy-%Ol'
%Om-%Oy-%Ol
$ echo $?
0

The E modifier is similarly affected.

Test

#[test]
fn test_date_strftime_o_modifier() {
    new_ucmd!()
        .env("LC_ALL", "C")
        .env("TZ", "UTC")
        .arg("-d")
        .arg("2024-06-15")
        .arg("+%Om-%Oy-%Ol")
        .succeeds()
        .stdout_is("06-24-12\n");
}

Guida contributor