find: -printf %A@ and %T@ reject timestamps before 1970

Aperta
#927 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@zhangpan2001 ci sta già lavorando.

Dal 27/10/2026.

  • #928 di @zhangpan2001 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
cli

Direzione di ricerca

The issue points to src/find/matchers/printf.rs, where TimeFormat::SinceEpoch calls duration_since(UNIX_EPOCH)?. Read that implementation and inspect nearby tests for %A@ and %T@; reproduce with the issue’s pre-1970 example. Done means -printf and -fprintf print negative epoch seconds, including fractional timestamps, without the error.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

%A@ and %T@ should print negative epoch seconds for files whose access or modification time is before 1970. Current main instead reports an error and stops rendering the format for that file, while still exiting 0.

From the repository root after building:

uu_find="$PWD/target/debug/find"
tmp=$(mktemp -d)
(
    cd "$tmp" || exit
    touch -a -m -d '1969-12-31 23:59:59 UTC' file
    LC_ALL=C /usr/bin/find file -printf '%A@|%T@\n'
    LC_ALL=C "$uu_find" file -printf '%A@|%T@\n'
)

GNU findutils 4.11.0 prints:

-1.0000000000|-1.0000000000

uutils prints no stdout and reports:

Error processing 'file': second time provided was later than self

Both exit 0. The same problem occurs with -fprintf, and fractional timestamps before the epoch also fail. Timestamps at or after the epoch work.

TimeFormat::SinceEpoch uses duration_since(UNIX_EPOCH)?, which rejects negative offsets. This is separate from #914, which fixes pre-1970 comparisons for -newerXt.

Tested with uutils findutils 0.11.0, main 82cfc21f0d45fc654588f0f4243e9c6e5f57fc97, on Debian forky/sid, Linux x86_64, against /usr/bin/find from GNU findutils 4.11.0.

Lingua principale
Rust
Stelle
657
Fork
115
Merge medio
1g 9h
PR unite (30g)
31

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di uutils/findutils

Tutte le issue di uutils/findutils

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.