Closed Sparika closed 2 years ago
The following code snippets fix the issue for me
fn parse_version(version: &str) -> Option<(u32, u32, u32)> {
if let Some(version) = version.splitn(2, '-').next() {
if let Some(version) = version.splitn(2, '+').next() {
let parts: Vec<_> = version.splitn(4, '.').filter_map(|v| u32::from_str(v).ok()).collect();
if parts.len() < 3 {
return None;
}
return Some((parts[0], parts[1], parts[2]))
}
}
None
}
Encountered the same problem :) By the way, how do you use sudo
on cargo, I tried sudo -E
but it did not work
@Forsworns you realistically cargo build --release
, and sudo ./target/release/program
as 2 separate steps.
@Sparika would you mind opening a PR for the changeset that got it working for you? Seems like a useful addition to the lib.
@Forsworns Ah, now I got ya! It would be helpful if you could open a separate issue with your problem and error messages you're getting. Unfortunately I don't have a Windows box on hand, so I can only help you remotely based on these.
I followed the tutorial on my WSL2 environment. The user space program panics when unwraping
None
withinget_version
. Here is the backtrace:While investigating the issue, I found that
parse_version
function expects a kernel version inx.y.z
format. However, the WSL2 kernel version I use has 4 elements.