[Pkg-rust-maintainers] Bug#1071216: asahi-btsync: calling of asahi-btsync panics
Blair Noctis
ncts at debian.org
Sun Sep 1 03:09:25 BST 2024
On Thu, 16 May 2024 12:10:04 +0200 Thomas Renard <cybaer42 at web.de> wrote:>
Package: asahi-btsync
> Version: 0.2.0-1+b1
> Severity: normal
>
> Dear Maintainer,
>
> calling of asahi-btsync panics.
>
> - call asahi-btsync
Let's read some Rust:
fn real_main() -> Result<()> {
let matches = clap::command!()
.arg(clap::arg!(-d --device [DEVICE] "Path to the nvram device."))
.subcommand(clap::Command::new("list").about("Parse shared Bluetooth
keys from nvram")) .subcommand(
clap::Command::new("sync")
.about("Sync Bluetooth device information from nvram")
.arg(clap::arg!(-c --config [CONFIG] "Bluez config path."))
.arg(clap::Arg::new("variable").multiple_values(true)),
)
.subcommand(
clap::Command::new("dump").about("Dump binary Bluetooth device info
from nvram"), )
.get_matches();
let default_name = "/dev/mtd0ro".to_owned();
let default_config = "/var/lib/bluetooth".to_owned();
let bt_var = "BluetoothUHEDevices";
let mut file = OpenOptions::new()
.read(true)
.open(matches.get_one::<String>("device").unwrap_or(&default_name))
.unwrap();
let mut data = Vec::new();
file.read_to_end(&mut data).unwrap();
let mut nv = nvram_parse(&data)?;
let active = nv.active_part_mut();
let bt_devs = active
.get_variable(bt_var.as_bytes(), VarType::System)
---> .ok_or(Error::VariableNotFound)?; // <--- your error occurred here!
> expect:
>
> this should show the help page (because it needs parameters)
As you can see it uses the clap crate to provide the command line interface,
and clap, by default, provides help message through the -h,--help options.
> actual:
>
> thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value:
> VariableNotFound', src/main.rs:52:17 note: run with `RUST_BACKTRACE=1`
> environment variable to display a backtrace
As evidented by the code, your run threw the VariableNotFound error, which is
when it tried to get the "BluetoothUHEDevices" variable but failed.
As this is an Apple only thing, please report to upstream:
https://github.com/WhatAmISupposedToPutHere/asahi-nvram/issues.
--
Sdrager,
Blair Noctis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-rust-maintainers/attachments/20240901/3cbeacc8/attachment-0001.sig>
More information about the Pkg-rust-maintainers
mailing list