Skip to content

std::process::Command is broken on VMWare ESXi #129654

Open
@aapanfilovv

Description

@aapanfilovv

std::process::Command is broken on VMWare ESXi, probably VMKernel does't support a SOCK_SEQPACKET

I tried this code:

// main.rs
use std::process::{Command, Stdio};

fn main() {
    let res = Command::new("ls")
        .arg("-l")
        .output()
        .unwrap();
    println!("status = {:?}", res.status);
    println!("stderr = {:?}", String::from_utf8_lossy(&res.stderr));
    println!("stdout = {:?}", String::from_utf8_lossy(&res.stdout));
}
# Cross.toml
[target.x86_64-unknown-linux-gnu]
image = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu:0.2.2-centos"

Build with cross:
cross +nightly build -Zbuild-std=std --target x86_64-unknown-linux-gnu --release

I expected to see this happen: exit status code, stdout, stderr of ls process

Instead, this happened: panic with message: thread 'main' panicked at /home/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/process.rs:153:17: called `Result::unwrap()` on an `Err` value: Os { code: 25, kind: Uncategorized, message: "Inappropriate ioctl for device" }

But if I change the code a little:

// main.rs
use std::process::{Command, Stdio};

fn main() {
    let res = Command::new("ls")
        .arg("-l")
        .stderr(Stdio::null()) // <--
        .output()
        .unwrap();
    println!("status = {:?}", res.status);
    println!("stderr = {:?}", String::from_utf8_lossy(&res.stderr));
    println!("stdout = {:?}", String::from_utf8_lossy(&res.stdout));
}

Panic message is changed: thread 'main' panicked at src/main.rs:10:10: called `Result::unwrap()` on an `Err` value: Os { code: 22, kind: InvalidInput, message: "Invalid argument" }

Meta

rustc --version --verbose of current toolchain:

rustc 1.82.0-nightly (60d146580 2024-08-06)
binary: rustc
commit-hash: 60d146580c10036ce89e019422c6bc2fd9729b65
commit-date: 2024-08-06
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0

rustc --version --verbose of working toolchain:

rustc 1.73.0-nightly (f88a8b71c 2023-08-08)
binary: rustc
commit-hash: f88a8b71cebb730cbd5058c45ebcae1d4d9be377
commit-date: 2023-08-08
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 17.0.0

rustc --version --verbose of first broken toolchain:

rustc 1.73.0-nightly (08d00b40a 2023-08-09)
binary: rustc
commit-hash: 08d00b40aef2017fe6dba3ff7d6476efa0c10888
commit-date: 2023-08-09
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 17.0.0

vmware -v:

VMware ESXi 8.0.1 build-21813344

Affected commit: #113939

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-processArea: `std::process` and `std::env`C-bugCategory: This is a bug.O-linuxOperating system: LinuxT-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions