From da0f59f756d0f49ba5695e707dcad2c3c1e4242c Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Mon, 23 Oct 2023 16:50:08 +0200 Subject: [PATCH] Linux/lsb_release: parse version string (#318) When the lsb_release executable is not found the version is taken from /etc/os_release and properly parsed. When it is found, however, the string was essentially not parsed, resulting in only Version::Custom objects to be returned. Calling the proper parsing function does the trick, and Version::Semantic objects get created as expected. The nearly manual handling of "rolling" for lsb_release, however, looks very suspicous, it should likely be folded to Version::from_string() instead. Signed-off-by: Yann Dirson --- os_info/src/linux/lsb_release.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os_info/src/linux/lsb_release.rs b/os_info/src/linux/lsb_release.rs index 674fb51..4c0912a 100644 --- a/os_info/src/linux/lsb_release.rs +++ b/os_info/src/linux/lsb_release.rs @@ -11,7 +11,7 @@ pub fn get() -> Option { let version = match release.version.as_deref() { Some("rolling") => Version::Rolling(None), - Some(v) => Version::Custom(v.to_owned()), + Some(v) => Version::from_string(v.to_owned()), None => Version::Unknown, };