gevico/machina

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

Open

#85 geöffnet am 25. Apr. 2026

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (1 zugewiesene Person)Rust (24 Forks)github user discovery
buggood first issuehelp wanted

Repository-Metriken

Stars
 (31 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

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.

Contributor Guide