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

Use full path to sysctl on FreeBSD #358

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

zanchey
Copy link
Contributor

@zanchey zanchey commented Jan 6, 2024

Calling get_os on FreeBSD without /sbin/ in your $PATH causes a panic:

thread 'main' panicked at /rust/deps/os_info-3.7.0/src/freebsd/mod.rs:37:18:
Failed to check if is hardened: Os { code: 2, kind: NotFound, message: "No such file or directory" }
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e51e98dde6a60637b6a71b8105245b629ac3fe77/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/e51e98dde6a60637b6a71b8105245b629ac3fe77/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/e51e98dde6a60637b6a71b8105245b629ac3fe77/library/core/src/result.rs:1649:5
   3: os_info::imp::current_platform
   4: os_info::get
...

Call the binary with a full path instead.

Calling get_os on FreeBSD without `/sbin/` in your $PATH causes a panic:

```
thread 'main' panicked at /rust/deps/os_info-3.7.0/src/freebsd/mod.rs:37:18:
Failed to check if is hardened: Os { code: 2, kind: NotFound, message: "No such file or directory" }
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e51e98dde6a60637b6a71b8105245b629ac3fe77/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/e51e98dde6a60637b6a71b8105245b629ac3fe77/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/e51e98dde6a60637b6a71b8105245b629ac3fe77/library/core/src/result.rs:1649:5
   3: os_info::imp::current_platform
   4: os_info::get
...
```

Call the binary with a full path instead.
Copy link
Owner

@stanislav-tkach stanislav-tkach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the very late reply and thank you for the pull request!

@stanislav-tkach
Copy link
Owner

By the way, I don't think the library should panic in this case. I will fix this issue in a separate pull request.

@stanislav-tkach stanislav-tkach merged commit 2f7258a into stanislav-tkach:master Feb 20, 2024
@zanchey zanchey deleted the freebsd-panic branch February 21, 2024 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants