From 26456182346dcdb5d44e87fd64b0c868fcb77233 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Fri, 16 Feb 2024 16:15:56 -0500 Subject: [PATCH] platform-host: fix musl version detection bug I'm not quite sure how this was every working before. It's possible it has never worked, but that our other methods of OS detection were working. In any case, empirically, it seems that the version number components for musl can be a single digit. Fixes #1427 --- crates/platform-host/src/linux.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/crates/platform-host/src/linux.rs b/crates/platform-host/src/linux.rs index e75fbc67d88c3..e1d6d2b0bcea5 100644 --- a/crates/platform-host/src/linux.rs +++ b/crates/platform-host/src/linux.rs @@ -168,7 +168,7 @@ fn detect_musl_version(ld_path: impl AsRef) -> Result { fn musl_ld_output_to_version(kind: &str, output: &[u8]) -> Result { static RE: Lazy = - Lazy::new(|| Regex::new(r"Version ([0-9]{2,4})\.([0-9]{2,4})").unwrap()); + Lazy::new(|| Regex::new(r"Version ([0-9]{1,4})\.([0-9]{1,4})").unwrap()); let output = std::str::from_utf8(output).map_err(|err| { PlatformError::OsVersionDetectionError(format!("failed to parse {kind} as UTF-8: {err}")) @@ -180,7 +180,7 @@ fn musl_ld_output_to_version(kind: &str, output: &[u8]) -> Result