Print more than one backtrace on error

Abierto
#5 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust
Área
devtools

Línea de trabajo

The payload names only the cga.toml whitelist format and the diagnostic text it produces, which lists 'backtrace (1 of N)' with one entry point and one trace. Start by reproducing the lint on the rsop repository with cargo cga check and reading the cga repository's handling of the whitelist entries and the note output. Done means the maintainers agree on how many backtraces to show and in what form, and a single run reports them. The thread has no decision yet, so settle the design with the maintainer before writing code.

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

Descripción

Currently when I run cargo cga check on https://codeberg.org/heiko/rsop, I get an error which shows me a single entry point (main function) and a single backtrace starting from it:

error: call to function `sop::cli::main` which can panic
 --> rsop/src/bin/rsop.rs:6:5
  |
6 |     sop::cli::main(&mut rpgpie_sop::RPGSOP::default(), sop::cli::Variant::Full);
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: 12 different panics from this location
  = note: backtrace (1 of 300953334964):
          0: core::panicking::panic (called)
          1: std::sys::sync::once::futex::Once::call (called)
          2: std::sync::Once::call_once_force::<{closure@std::sync::OnceLock<std::sync::Mutex<std::io::BufReader<std::io::stdio::StdinRaw>>>::initialize<{closure@std::sync::OnceLock<std::sync::Mutex<std::io::BufReader<std::io::stdio::StdinRaw>>>::get_or_init<{closure@std::io::stdin::{closure#0}}>::{closure#0}}, !>::{closure#0}}> (called)
          3: std::sync::OnceLock::<std::sync::Mutex<std::io::BufReader<std::io::stdio::StdinRaw>>>::initialize::<{closure@std::sync::OnceLock<std::sync::Mutex<std::io::BufReader<std::io::stdio::StdinRaw>>>::get_or_init<{closure@std::io::stdin::{closure#0}}>::{closure#0}}, !> (called)
          4: std::sync::OnceLock::<std::sync::Mutex<std::io::BufReader<std::io::stdio::StdinRaw>>>::get_or_try_init::<{closure@std::sync::OnceLock<std::sync::Mutex<std::io::BufReader<std::io::stdio::StdinRaw>>>::get_or_init<{closure@std::io::stdin::{closure#0}}>::{closure#0}}, !> (called)
          5: std::sync::OnceLock::<std::sync::Mutex<std::io::BufReader<std::io::stdio::StdinRaw>>>::get_or_init::<{closure@std::io::stdin::{closure#0}}> (called)
          6: std::io::stdin (called)
          7: sop::cli::real_main::<'_, rpgpie_sop::RPGSOP, rpgpie_sop::Certs, rpgpie_sop::Keys, rpgpie_sop::Sigs> (called)
          8: sop::cli::main::<'_, rpgpie_sop::RPGSOP, rpgpie_sop::Certs, rpgpie_sop::Keys, rpgpie_sop::Sigs> (called) <--
          9: rsop::main (entrypoint)
  = note: `#[deny(cga::panics)]` on by default

warning: [email protected]: rsop: shell completions written to /home/user/src/rsop/./target/cga/debug/build/rsop/032fe99886f2720a/out
warning: [email protected]: rsop: man pages written to /home/user/src/rsop/./target/cga/debug/build/rsop/032fe99886f2720a/out
error: could not compile `rsop` (bin "rsop") due to 1 previous error
Error: 101

In this case I want to add std::io::stdin to cga.toml whitelist and then rerun cargo cga check --config-path ./cga.toml. Then I get another backtrace, but each time the whole compilation is restarted so it will take me forever to collect all the functions that i trust.

Is there a way to get in a single run what all "12 different panics from this location" are or print more backtraces (definitely not all 300953334964 backtraces) at once?

My current cga.toml is this:

whitelist = [
  { crate = "core" },
  { crate = "env_logger" },
  { path = "^std::rt::panic_fmt" },
  { path = "^std::process::exit" },
  { path = "^sop::Password::new" },
  { path = "^std::io::stdout" },
  { path = "^std::io::stdin" }
]
Lenguaje dominante
Rust
Estrellas
50
Forks
4
Merge medio
4 d 12 h
PR fusionados (30 d)
4

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 OpenDevicePartnership/cga

Todos los issues de OpenDevicePartnership/cga

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.