radicle-heartwood-lfs/crates
Lorenz Leutgeb 192cc993a8 radicle: Fix panic when reading from SQLite database fails
I was greeted by `rad patch redact` with

    called `Result::unwrap()` on an `Err` value:

      Error { code: None, message: Some("failed to convert") }

    stack backtrace:

    […]
       3: core::result::Result<T,E>::unwrap
             at …/rust-1.88.0/lib/rustlib/src/rust/library/core/src/result.rs:1137:23
       4: sqlite::cursor::Row::read
             at …/index.crates.io-1949cf8c6b5b557f/sqlite-0.32.0/src/cursor.rs:136:9
       5: radicle::cob::patch::cache::query::find_by_revision
             at ./crates/radicle/src/cob/patch/cache.rs:624:65
       6: <… as radicle::cob::patch::cache::Patches>::find_by_revision
             at ./crates/radicle/src/cob/patch/cache.rs:553:9
       7: radicle_cli::commands::rad_patch::redact::run
             at ./crates/radicle-cli/src/commands/patch/redact.rs:23:9
       8: radicle_cli::commands::rad_patch::run
             at ./crates/radicle-cli/src/commands/patch.rs:1026:13
    […]

It turns out that `sqlite::cursor::Row::read` is the panicky version of
`sqlite::cursor::Row::try_read` (which returns a `Result`).

While it is somewhat rare that SQLite reads fail, it is not unheard of.
In `radicle-cli` it might not be critical, but also `radicle-protocol`
and `radicle-fetch` are affected, and they could potentially panic a
`radicle-node` process.

Use `try_read` instead, and propagate down the error handling.
2025-08-25 17:05:21 +01:00
..
radicle radicle: Fix panic when reading from SQLite database fails 2025-08-25 17:05:21 +01:00
radicle-cli radicle: Fix panic when reading from SQLite database fails 2025-08-25 17:05:21 +01:00
radicle-cli-test fix: upgrade radicle-crypto 2025-08-13 09:20:42 +01:00
radicle-cob cob: add method for loading entry manifest 2025-08-19 14:27:35 +01:00
radicle-crypto fix: upgrade radicle-crypto 2025-08-13 09:20:42 +01:00
radicle-dag repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
radicle-fetch radicle: Fix panic when reading from SQLite database fails 2025-08-25 17:05:21 +01:00
radicle-node protocol: Refactor encoding 2025-08-25 11:57:44 +01:00
radicle-protocol radicle: Fix panic when reading from SQLite database fails 2025-08-25 17:05:21 +01:00
radicle-remote-helper fix: Normalize filesystem paths with `dunce` 2025-08-22 15:11:43 +01:00
radicle-schemars fix: upgrade radicle-crypto 2025-08-13 09:20:42 +01:00
radicle-signals signals: Guard most of the crate for Unix 2025-08-22 15:19:31 +01:00
radicle-ssh release: prepare crates 2025-08-12 12:13:49 +02:00
radicle-systemd release: prepare crates 2025-08-12 12:13:49 +02:00
radicle-term refactor: Replace return Err(anyhow!()) with anyhow::bail!() 2025-08-17 20:17:11 +02:00