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.
15 files changed
+242
-144
a568e7f4
→
192cc993
modified crates/radicle-cli/src/commands/follow.rs
@@ -147,41 +147,45 @@ pub fn following(profile: &Profile, alias: Option<Alias>) -> anyhow::Result<()>
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| + | |
|
|
| - | |
|
|
|
|
|
|
|
|
|
|
|
|
| - | |
| + | |
| + | |
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified crates/radicle-cli/src/commands/seed.rs
@@ -203,21 +203,28 @@ pub fn seeding(profile: &Profile) -> anyhow::Result<()> {
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified crates/radicle-cli/src/commands/stats.rs
@@ -126,7 +126,7 @@ pub fn run(_options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -141,7 +141,7 @@ pub fn run(_options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -149,7 +149,7 @@ pub fn run(_options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -168,7 +168,7 @@ pub fn run(_options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -187,7 +187,7 @@ pub fn run(_options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
modified crates/radicle-fetch/src/policy.rs
@@ -30,9 +30,22 @@ impl Allowed {
|
|
|
|
|
|
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -62,10 +75,23 @@ impl BlockList {
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified crates/radicle-protocol/src/service.rs
@@ -570,13 +570,7 @@ where
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| + | |
|
|
|
|
|
@@ -750,11 +744,7 @@ where
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| + | |
|
|
|
|
|
@@ -2510,10 +2500,16 @@ where
|
|
|
|
|
|
| - | |
| - | |
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified crates/radicle-protocol/src/service/filter.rs
@@ -59,6 +59,30 @@ impl Filter {
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified crates/radicle-protocol/src/service/gossip/store.rs
@@ -135,7 +135,7 @@ impl Store for Database {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -360,9 +360,9 @@ mod parse {
|
|
|
|
|
|
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -377,8 +377,8 @@ mod parse {
|
|
|
|
|
|
| - | |
| - | |
| + | |
| + | |
|
|
|
|
|
modified crates/radicle/src/cob/cache/migrations/2.rs
@@ -27,8 +27,8 @@ pub fn run(
|
|
|
|
|
|
| - | |
| - | |
| + | |
| + | |
|
|
|
|
|
@@ -117,7 +117,7 @@ mod tests {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
modified crates/radicle/src/cob/issue/cache.rs
@@ -440,8 +440,8 @@ pub struct IssuesIter<'a> {
|
|
|
|
|
|
| - | |
| - | |
| + | |
| + | |
|
|
|
|
|
@@ -537,7 +537,7 @@ mod query {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -597,8 +597,8 @@ mod query {
|
|
|
|
|
|
| - | |
| - | |
| + | |
| + | |
|
|
|
|
|
modified crates/radicle/src/cob/patch/cache.rs
@@ -427,8 +427,8 @@ pub struct PatchesIter<'a> {
|
|
|
|
|
|
| - | |
| - | |
| + | |
| + | |
|
|
|
|
|
@@ -592,7 +592,7 @@ mod query {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -618,10 +618,11 @@ mod query {
|
|
|
|
|
|
| - | |
| - | |
| + | |
| + | |
|
|
| - | |
| + | |
| + | |
|
|
|
|
|
@@ -686,8 +687,8 @@ mod query {
|
|
|
|
|
|
| - | |
| - | |
| + | |
| + | |
|
|
|
|
|
modified crates/radicle/src/node/address/store.rs
@@ -115,15 +115,15 @@ impl Store for Database {
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
| - | |
| + | |
|
|
|
|
|
@@ -154,8 +154,8 @@ impl Store for Database {
|
|
|
|
|
|
| - | |
| - | |
| + | |
| + | |
|
|
|
|
|
@@ -183,16 +183,16 @@ impl Store for Database {
|
|
|
|
|
|
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
|
|
|
|
|
|
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -212,7 +212,7 @@ impl Store for Database {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -224,7 +224,7 @@ impl Store for Database {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -299,17 +299,17 @@ impl Store for Database {
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified crates/radicle/src/node/policy/config.rs
@@ -106,9 +106,20 @@ impl<T> Config<T> {
|
|
|
|
|
|
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified crates/radicle/src/node/policy/store.rs
@@ -257,13 +257,13 @@ impl<T> Store<T> {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -283,9 +283,9 @@ impl<T> Store<T> {
|
|
|
|
|
|
| - | |
| + | |
|
|
| - | |
| + | |
|
|
|
|
|
@@ -329,25 +329,38 @@ pub struct FollowPolicies<'a> {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
|
|
|
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
|
|
|
|
|
| - | |
|
|
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -356,19 +369,35 @@ pub struct SeedPolicies<'a> {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -457,9 +486,9 @@ mod test {
|
|
|
|
|
|
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -471,9 +500,9 @@ mod test {
|
|
|
|
|
|
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified crates/radicle/src/node/refs/store.rs
@@ -154,7 +154,7 @@ impl Store for Database {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
modified crates/radicle/src/node/routing.rs
@@ -108,7 +108,7 @@ impl Store for Database {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|