rust-lang / rust-lang/rust

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

Open
#129,654 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-process C-bug O-linux T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at library/std/src/sys_common/process.rs:153:17 and inspect the std::process::Command behavior changed by affected commit #113939. Reproduce the supplied example on VMware ESXi, comparing the working and broken nightly toolchains; done means Command::output reports the ls status, stdout, and stderr without the shown panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.