From fe883eafff9732d95a3998118ab7c8dea48d23bc Mon Sep 17 00:00:00 2001 From: Arrowana Date: Tue, 17 Dec 2024 11:51:30 +1100 Subject: [PATCH 1/2] fix: Anchor CLI ignore non semver releases to avoid panic --- cli/src/lib.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/cli/src/lib.rs b/cli/src/lib.rs index 05e8434f23..1f8a962562 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -556,16 +556,16 @@ fn override_toolchain(cfg_override: &ConfigOverride) -> Result String { - Regex::new(r"(\d+\.\d+\.\S+)") - .unwrap() - .captures_iter(text) - .next() - .unwrap() - .get(0) - .unwrap() - .as_str() - .to_string() + fn parse_version(text: &str) -> Option { + Some( + Regex::new(r"(\d+\.\d+\.\S+)") + .unwrap() + .captures_iter(text) + .next()? + .get(0)? + .as_str() + .to_string(), + ) } fn get_current_version(cmd_name: &str) -> Result { @@ -577,7 +577,7 @@ fn override_toolchain(cfg_override: &ConfigOverride) -> Result Result Date: Wed, 18 Dec 2024 18:00:13 +1100 Subject: [PATCH 2/2] avoid nesting, better error and changelog --- CHANGELOG.md | 1 + cli/src/lib.rs | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad4184eb8b..db2631b24a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -103,6 +103,7 @@ The minor version will be incremented upon a breaking change and the patch versi - lang: Require `zero` accounts to be unique ([#3409](https://github.com/coral-xyz/anchor/pull/3409)). - lang: Deduplicate `zero` accounts against `init` accounts ([#3422](https://github.com/coral-xyz/anchor/pull/3422)). - cli: Fix custom `provider.cluster` ([#3428](https://github.com/coral-xyz/anchor/pull/3428)). +- cli: Ignore non semver solana/agave releases to avoid panic ([#3432](https://github.com/coral-xyz/anchor/pull/3432)). ### Breaking diff --git a/cli/src/lib.rs b/cli/src/lib.rs index 1f8a962562..03ff43d19a 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -577,8 +577,8 @@ fn override_toolchain(cfg_override: &ConfigOverride) -> Result Result