Closed yonas closed 1 year ago
It looks like sysctl hw.model
may have returned an ill-formatted byte which led to the panic. I'm working on fixing this.
I went and wrapped the value_string
invocation using our own ReadoutError
which will propagate to macchina in a safe way. The panic should no longer occur and --doctor
will show us an error message that may or may not help.
❯ RUST_BACKTRACE=full target/release/macchina --doctor
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Utf8Error(Utf8Error { valid_up_to: 48, error_len: Some(1) })', /home/yonas/.cargo/registry/src/github.com-1ecc6299db9ec823/libmacchina-6.4.0/src/freebsd/mod.rs:245:14
stack backtrace:
0: 0x32a3d53dd75c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he71fd4eda74f87b0
1: 0x32a3d535696e - core::fmt::write::h5fd3e26984166a6e
2: 0x32a3d53c30b4 - std::io::Write::write_fmt::h69fa03c5d51d5c91
3: 0x32a3d53dd537 - std::sys_common::backtrace::print::h05788f88478cef7c
4: 0x32a3d53c3885 - std::panicking::default_hook::{{closure}}::h0a304c2f161776d3
5: 0x32a3d53c4194 - std::panicking::rust_panic_with_hook::h2b720056ea930d75
6: 0x32a3d53ddbb4 - std::panicking::begin_panic_handler::{{closure}}::h9b43afdf57796039
7: 0x32a3d53ddb1c - std::sys_common::backtrace::__rust_end_short_backtrace::he531317bc19f7b93
8: 0x32a3d53c3b01 - rust_begin_unwind
9: 0x32a3d53586d2 - core::panicking::panic_fmt::hf50430e1e32891db
10: 0x32a3d5358ae2 - core::result::unwrap_failed::ha57a5a37c8028fff
11: 0x32a3d5377a4c - macchina::data::get_all_readouts::hef727af34dbb0250
12: 0x32a3d53692e3 - macchina::main::h9baa4fd3d260d27c
13: 0x32a3d5365059 - std::sys_common::backtrace::__rust_begin_short_backtrace::hd5483f5276f70cc0
14: 0x32a3d53656c9 - main
❯ RUST_BACKTRACE=full target/release/macchina
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Utf8Error(Utf8Error { valid_up_to: 48, error_len: Some(1) })', /home/yonas/.cargo/registry/src/github.com-1ecc6299db9ec823/libmacchina-6.4.0/src/freebsd/mod.rs:245:14
stack backtrace:
0: 0x149b30c6d75c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he71fd4eda74f87b0
1: 0x149b30be696e - core::fmt::write::h5fd3e26984166a6e
2: 0x149b30c530b4 - std::io::Write::write_fmt::h69fa03c5d51d5c91
3: 0x149b30c6d537 - std::sys_common::backtrace::print::h05788f88478cef7c
4: 0x149b30c53885 - std::panicking::default_hook::{{closure}}::h0a304c2f161776d3
5: 0x149b30c54194 - std::panicking::rust_panic_with_hook::h2b720056ea930d75
6: 0x149b30c6dbb4 - std::panicking::begin_panic_handler::{{closure}}::h9b43afdf57796039
7: 0x149b30c6db1c - std::sys_common::backtrace::__rust_end_short_backtrace::he531317bc19f7b93
8: 0x149b30c53b01 - rust_begin_unwind
9: 0x149b30be86d2 - core::panicking::panic_fmt::hf50430e1e32891db
10: 0x149b30be8ae2 - core::result::unwrap_failed::ha57a5a37c8028fff
11: 0x149b30c07a4c - macchina::data::get_all_readouts::hef727af34dbb0250
12: 0x149b30bf92e3 - macchina::main::h9baa4fd3d260d27c
13: 0x149b30bf5059 - std::sys_common::backtrace::__rust_begin_short_backtrace::hd5483f5276f70cc0
14: 0x149b30bf56c9 - main
Did you point the libmacchina dependency to its git branch?
Something like:
# Cargo.toml
libmacchina = { git = "https://github.com/Macchina-CLI/libmacchina" }
@grtcdr After updating Cargo.toml
, I get this compile error:
Compiling macchina v6.1.8 (/usr/home/yonas/git/make-cd/files/macchina)
error[E0425]: cannot find function `version` in crate `libmacchina`
--> src/main.rs:118:46
|
118 | println!("libmacchina {}", libmacchina::version());
| ^^^^^^^ not found in `libmacchina`
For more information about this error, try `rustc --explain E0425`.
error: could not compile `macchina` due to previous error
I didn't get this error for pfetch-rs after updating its Cargo.toml.
Sorry about this.
You should also enable the version
feature.
libmacchina = { git = "https://github.com/Macchina-CLI/libmacchina", features = ["version"] }
It works now, thanks!