Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ and listed with their assets on the

## [Unreleased]

### Fixed

- **Sharing on Windows finds devstack installed as the setup says.** The
hub ran its scripts in the WSL distribution with `wsl.exe … -- sh -c`,
which hands them to the distribution's shell first: that shell expanded
them before `sh` ran, so the setup's check looked for devstack without
`~/.local/bin`, where `install.sh` puts it, and said "devstack is not
installed in the distribution" right after the install. The hub runs
them with `--exec` now, as written (#597). Until this release, a link
helps: `ln -sf /root/.local/bin/devstack /usr/local/bin/devstack` in the
distribution as root.

## [0.51.0] - 2026-11-19

Sharing a machine starts with a setup dialog: it says what sharing does,
Expand Down
30 changes: 27 additions & 3 deletions crates/devstack-hub/src/nodehost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -968,10 +968,12 @@ pub mod wsl {
}

/// `script` in `distro` as root, with `~/.local/bin` (where
/// `install.sh` puts devstack) and WSL's GPU tools on `PATH`.
fn sh(distro: &str, script: &str) -> Command {
/// `install.sh` puts devstack) and WSL's GPU tools on `PATH`. With
/// `--exec`, not `--`: that hands the command to the distribution's
/// shell first, which expands the script before `sh` sees it (#597).
pub fn sh(distro: &str, script: &str) -> Command {
let mut c = command();
c.args(["-d", distro, "-u", "root", "--", "sh", "-c"]);
c.args(["-d", distro, "-u", "root", "--exec", "sh", "-c"]);
c.arg(format!(
"PATH=\"$HOME/.local/bin:/usr/local/bin:/usr/lib/wsl/lib:$PATH\"; export PATH; {script}"
));
Expand Down Expand Up @@ -1397,6 +1399,28 @@ mod tests {
assert_eq!(guests_or(None, None), None);
}

/// #597: `wsl.exe … -- cmd` hands `cmd` to the distribution's default
/// shell first, which expands `$HOME`, `$PATH` and every `$(…)` of the
/// script before `sh` runs it: the probe then looked for devstack on
/// the default `PATH`, without `~/.local/bin`. `--exec` runs `sh` with
/// the script as one argument, as written.
#[test]
fn a_script_reaches_sh_in_the_distribution_as_written() {
let script = "echo \"devstack=$(devstack --version)\"";
let c = wsl::sh("Ubuntu-24.04", script);
let args: Vec<String> = c
.get_args()
.map(|a| a.to_string_lossy().into_owned())
.collect();
let exec = args.iter().position(|a| a == "--exec");
assert!(exec.is_some(), "{args:?}");
assert!(!args.iter().any(|a| a == "--"), "{args:?}");
let rest = &args[exec.unwrap() + 1..];
assert_eq!(rest[..2], ["sh", "-c"], "{args:?}");
assert_eq!(rest.len(), 3, "the script is one argument: {args:?}");
assert!(rest[2].ends_with(script) && rest[2].contains("$HOME/.local/bin"));
}

#[test]
fn words_for_sh_and_lines_of_wsl_exe() {
assert_eq!(wsl::quote("a b"), "'a b'");
Expand Down
5 changes: 3 additions & 2 deletions docs/pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ did; their owners stop them, or an admin ends the lease.
`networkingMode=mirrored` in `.wslconfig`, and devstack of the same
version installed as root. The hub copies the machine's membership into
it (`/var/lib/devstack-node/<pool>`, root only: one member per machine)
and runs `wsl.exe -d <distro> -u root -- devstack node agent --membership
…`. It never sets the distribution up: it checks it (the networking mode,
and runs `wsl.exe -d <distro> -u root --exec sh -c 'exec devstack node agent
--membership …'` (with `~/.local/bin`, where `install.sh` puts devstack, on
`PATH`). It never sets the distribution up: it checks it (the networking mode,
the engine, devstack's version, an NVIDIA GPU and the container toolkit,
the Hyper-V firewall rule `devstack-node` for the port) and shows what is
missing with the command for it, and a prompt a coding agent can work
Expand Down
Loading