gevico/machina

[Open Source Workshop] Warn when -device is ignored on non-Unix or for unsupported devices

Open

#85 aberto em 25 de abr. de 2026

Ver no GitHub
 (0 comments) (0 reactions) (1 assignee)Rust (24 forks)github user discovery
buggood first issuehelp wanted

Métricas do repositório

Stars
 (31 stars)
Métricas de merge de PR
 (Métricas PR pendentes)

Description

Problem Description

In src/main.rs lines 192-203, the -device handler only enables virtio-net-device on Unix platforms:

"-device" => {
    let val = args.get(i).ok_or("-device requires argument")?;
    #[cfg(unix)]
    if val.starts_with("virtio-net-device,") {
        cli.device_net_raw = Some(val.clone());
    }
    let _ = val;
}

On Windows or other non-Unix platforms, a user passing -device virtio-net-device,netdev=net0 has the device silently dropped with no warning.

Even on Unix platforms, unsupported device names such as virtio-blk-device are silently ignored.

Expected Behavior

  1. On non-Unix platforms, when -device is specified, print a warning explaining that the device type is unsupported on that platform.
  2. On Unix platforms, print a warning for unsupported device names.

Affected Files

  • src/main.rs lines 192-203

Difficulty Notes

This only requires adding conditional branches and eprintln! warnings.

Guia do colaborador