Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aborts when no modules present #138

Closed
lockbox opened this issue Mar 31, 2024 · 4 comments · Fixed by #139
Closed

aborts when no modules present #138

lockbox opened this issue Mar 31, 2024 · 4 comments · Fixed by #139
Labels
bug Something isn't working

Comments

@lockbox
Copy link

lockbox commented Mar 31, 2024

in this case under lxc on a chromebook (and probably on generic linux in a few other cases eg with no runtime modules) there is no /proc/modules, so this panic's. In this case could it just return and empty string so it would not panic, and then show an empty set of modules?

kmon/src/kernel/lkm.rs

Lines 117 to 118 in 3ed516f

let modules_content = util::exec_cmd("sh", &["-c", &module_read_cmd])
.expect("failed to read /proc/modules");

@lockbox lockbox changed the title aborts when running under lxc aborts when no modules present Mar 31, 2024
@orhun orhun added the bug Something isn't working label Apr 1, 2024
@orhun
Copy link
Owner

orhun commented Apr 1, 2024

Hey, thanks for reporting!

In this case could it just return and empty string so it would not panic, and then show an empty set of modules?

Yes I agree. Would you be interested in submitting a PR to fix this?

@eld4niz
Copy link
Contributor

eld4niz commented Apr 1, 2024

hey, @orhun. I tried changing that mentioned line to something like this:

let modules_content = util::exec_cmd("sh", &["-c", &module_read_cmd]).unwrap_or_else(|_| String::new());

should I also add few lines for parsing part?

@lockbox
Copy link
Author

lockbox commented Apr 1, 2024

Would also probably be worth adding a log message or something since the display is just blank

@lockbox
Copy link
Author

lockbox commented Apr 1, 2024

hey, @orhun. I tried changing that mentioned line to something like this:

let modules_content = util::exec_cmd("sh", &["-c", &module_read_cmd]).unwrap_or_else(|_| String::new());

should I also add few lines for parsing part?

Thanks, saves me the time doing an MR lol🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants