[Bug]: hl panics on a relative --since or --until too far from now
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 87/100
Línea de trabajo
Lee src/timeparse.rs en relative_past y relative_future; después, comprueba cómo sus llamadores convierten None en Error::UnrecognizedTime. Sustituye la aritmética de tiempo que se desborda por operaciones con comprobación y verifica que los valores extremos de --since y --until devuelvan un error en lugar de provocar un panic.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Observed
A relative time that reaches past the range of dates that hl can represent makes hl panic instead of reporting an error:
$ echo '{"ts":"2024-01-01T00:00:00Z","msg":"x"}' | hl --since -300000y -P
thread 'run' panicked at src/timeparse.rs:28:18:
`DateTime - TimeDelta` overflowed
--until +300000y does the same with +.
Expected
An error saying the time is out of range, as for any other value that --since and --until don't accept. A crash is a bug whatever the spec says. No spec covers relative times: specs/003-structured-logs/spec.md mentions --since and --until only for the format they take.
Where
relative_past and relative_future at src/timeparse.rs:25-41 add the duration to Utc::now() with the - and + operators of chrono, which panic on overflow. checked_sub_signed and checked_add_signed return None instead, which the callers already turn into Error::UnrecognizedTime.
clippy's unchecked_time_subtraction lint, enabled for #1890, covers only the std Instant and Duration types, so it doesn't catch this.
- Lenguaje dominante
- Rust
- Estrellas
- 3.3k
- Forks
- 67
- Merge medio
- 3 h 4 min
- PR fusionados (30 d)
- 107
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pamburus/hl
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
bug resolved
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
pamburus/hl#1877 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
Todos los issues de pamburus/hl
Issues similares
-
area:ui effort:medium enhancement P7 source:agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
marketing
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Read a requested CodeRabbit PR review's findings with `coderabbit pullrequest --show-threads`Abiertodocumentation priority: low tech-debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
nledford/Ladderback#1823 ·
Los mantenedores suelen responder en 1 día
-
psmux-resurrect: restoring a session with a numeric name puts its windows into the wrong session (`new-window -t 4` is read as window 4)Posiblemente ocupada @ealwanlee la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
psmux/psmux-plugins#47 ·
-
Link Checker ReportAbiertoautomated issue report
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
ratatui/awesome-ratatui#598 ·
Los mantenedores suelen responder en 1 día