Skip to content

fix(hub): scripts in the WSL distribution reach sh as written (--exec) - #598

Merged
7schmiede merged 1 commit into
mainfrom
fix/597-wsl-exec
Nov 19, 2026
Merged

7schmiede merged 1 commit into
mainfrom
fix/597-wsl-exec

Conversation

@7schmiede

Copy link
Copy Markdown
Member

What and why

wsl::sh (crates/devstack-hub/src/nodehost.rs) ran every script in the WSL distribution as wsl.exe -d <distro> -u root -- sh -c <script>. With --, wsl.exe hands the command to the distribution's default shell first, which expands the script before sh runs it. The setup's probe then ran devstack --version without ~/.local/bin on PATH, where install.sh puts devstack. On a pool member's Windows machine the dialog kept saying "devstack is not installed in the distribution" right after the install. --exec passes the script to sh unchanged.

No review card: a fix of how ADR-0113's agent is started; docs/pool.md now names the call.

Bug fix

Cause wsl.exe … -- runs the command through the distribution's shell, which expanded the script before sh saw it.
Bug class shell-reparsed-arguments
Proof Test nodehost::a_script_reaches_sh_in_the_distribution_as_written pins the arguments; red before at --exec missing. Against a real distribution (Docker Desktop's, here): the probe's PATH prefix plus a $(…) gave /usr/local/sbin as the first PATH entry with --, /root/.local/bin with --exec. Hub unit tests 178/178. Not checked: the share switch end to end on a member's machine with this build.
Siblings No other wsl.exe call in the crates; the kill and copy scripts go through the same wsl::sh and are fixed with it. ADR-0113 keeps its wording (… -- devstack node agent) as history; docs/pool.md is updated.
Guard The test fails if -- comes back or the script is split into several arguments.

Workaround until a release: ln -sf /root/.local/bin/devstack /usr/local/bin/devstack in the distribution as root.

Closes #597

🤖 Generated with Claude Code

`wsl::sh` ran `wsl.exe -d <distro> -u root -- sh -c <script>`. With `--`,
wsl.exe hands the command to the distribution's default shell first,
which expands `$HOME`, `$PATH` and every `$(…)` before `sh` runs the
script: the setup's probe ran `devstack --version` on the default PATH,
without `~/.local/bin` where install.sh puts devstack, and the dialog said
"devstack is not installed in the distribution" right after the install.
`--exec` runs `sh` with the script as one argument.

Checked against a distribution here: the same script printed
`/usr/local/sbin` as the first PATH entry inside `$(…)` with `--`, and
`/root/.local/bin` with `--exec`.

Closes #597

Bug-Class: shell-reparsed-arguments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit 9ca60ce into main Nov 19, 2026
14 checks passed
@7schmiede
7schmiede deleted the fix/597-wsl-exec branch November 19, 2026 17:05
@7schmiede 7schmiede mentioned this pull request Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The hub's scripts in WSL go through the distribution's shell first: devstack in ~/.local/bin is not found

1 participant