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

Abierto
#927 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@zhangpan2001 ya está trabajando en esto.

Desde el 27/10/2026.

  • #928 de @zhangpan2001 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
30/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
rust
Área
cli

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

%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.

Lenguaje dominante
Rust
Estrellas
657
Forks
115
Merge medio
1 d 9 h
PR fusionados (30 d)
31

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de uutils/findutils

Todos los issues de uutils/findutils

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.