gevico/machina

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

Open

#85 ouverte le 25 avr. 2026

Voir sur GitHub
 (0 commentaires) (0 réactions) (1 assigné)Rust (24 forks)github user discovery
buggood first issuehelp wanted

Métriques du dépôt

Stars
 (31 stars)
Métriques de merge PR
 (Métriques PR en attente)

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.

Guide contributeur