Skip to content

Commit

Permalink
Linux/lsb_release: parse version string (stanislav-tkach#318)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ydirson committed Oct 23, 2023
1 parent 8de3030 commit da0f59f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion os_info/src/linux/lsb_release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn get() -> Option<Info> {

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,
};

Expand Down

0 comments on commit da0f59f

Please sign in to comment.