Repository navigation
fix(hub): scripts in the WSL distribution reach sh as written (--exec) - #598
Merged
Merged
Conversation
`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>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
wsl::sh(crates/devstack-hub/src/nodehost.rs) ran every script in the WSL distribution aswsl.exe -d <distro> -u root -- sh -c <script>. With--,wsl.exehands the command to the distribution's default shell first, which expands the script beforeshruns it. The setup's probe then randevstack --versionwithout~/.local/binonPATH, whereinstall.shputs devstack. On a pool member's Windows machine the dialog kept saying "devstack is not installed in the distribution" right after the install.--execpasses the script toshunchanged.No review card: a fix of how ADR-0113's agent is started;
docs/pool.mdnow names the call.Bug fix
wsl.exe … --runs the command through the distribution's shell, which expanded the script beforeshsaw it.shell-reparsed-argumentsnodehost::a_script_reaches_sh_in_the_distribution_as_writtenpins the arguments; red before at--execmissing. Against a real distribution (Docker Desktop's, here): the probe'sPATHprefix plus a$(…)gave/usr/local/sbinas the firstPATHentry with--,/root/.local/binwith--exec. Hub unit tests 178/178. Not checked: the share switch end to end on a member's machine with this build.wsl.execall in the crates; the kill and copy scripts go through the samewsl::shand are fixed with it. ADR-0113 keeps its wording (… -- devstack node agent) as history;docs/pool.mdis updated.--comes back or the script is split into several arguments.Workaround until a release:
ln -sf /root/.local/bin/devstack /usr/local/bin/devstackin the distribution as root.Closes #597
🤖 Generated with Claude Code