build-launcher: pass the layer's flags whole when a path holds a space #380

Closed
github-bot wants to merge 0 commits from github-bot/gh-380 into main AGit
Owner

@⁠erdemcisse on GitHub · 2026-12-01 20:38 UTC · original
erdemcisse:fix/build-launcher-path-with-spaces → main · +6 −2 · 1 files · 72 commits · closed without merging

What and why

scripts/build-launcher.ps1 -Package cannot build the layer when the checkout or the user profile sits under a path with a space in it (C:\Users\John Smith\Downloads\foxhound), reported in #349.

cargo splits RUSTFLAGS at every space and has no quoting, so the two --remap-path-prefix flags and -C target-cpu=x86-64-v3 reach the compiler in pieces:

error: --remap-path-prefix must contain '=' between FROM and TO

which the script reports as the layer did not build. CARGO_ENCODED_RUSTFLAGS carries the same flags separated by U+001F instead — a character no Windows path can hold — so each flag arrives whole, and nothing changes on a path without spaces (the value is set and removed inside the same block).

Tested

No MSVC toolchain on this machine, so the check is the flags the script hands over, with a stand-in cargo that behaves like the real one (splits RUSTFLAGS at spaces, splits CARGO_ENCODED_RUSTFLAGS at U+001F, CARGO_ENCODED_RUSTFLAGS winning) and passes the result to a real rustc 1.98.1 --print sysroot.

Checkout in ...\_pr_work\pr space test\foxhound.

Before (this branch's parent, unchanged script):

cargo-stub: RUSTFLAGS set
cargo-stub: rustc argv = [--remap-path-prefix=C:\Users\CISSE=~] [--remap-path-prefix=C:\Users\CISSE\Downloads\_pr_work\pr] [space] [test\foxhound=.] [-C] [target-cpu=x86-64-v3]
error: --remap-path-prefix must contain '=' between FROM and TO
cargo-stub: rustc exit 1
the layer did not build

Real cargo 1.98.1 in the same folder fails the same way (its first rustc probe):

error: --remap-path-prefix must contain '=' between FROM and TO
        ... (exit code: 1)
the layer did not build

After (.\scripts\build-launcher.ps1 -Package, same folder):

built ...\target\launcher\Foxhound.exe
cargo-stub: CARGO_ENCODED_RUSTFLAGS set
cargo-stub: rustc argv = [--remap-path-prefix=C:\Users\CISSE=~] [--remap-path-prefix=C:\Users\CISSE\Downloads\_pr_work\pr space test\foxhound=.] [-C] [target-cpu=x86-64-v3]
C:\Users\CISSE\.rustup\toolchains\1.98.1-x86_64-pc-windows-gnu
cargo-stub: rustc exit 0

The run then stops at Copy-Item ...\target\dist\dist\victory.exe because the stand-in built nothing — the point of the check is that the build step itself now gets valid flags. [System.Management.Automation.Language.Parser]::ParseFile reports no syntax error in the edited script.

Not run here: a full -Package build (needs MSVC, and the release build is minutes long); a maintainer's run on a normal path is unchanged by this diff, and a run on a spaced path is the case this fixes.

GPUs tested: n/a (build script, no GPU involved).

AI-assisted: yes — written and tested with DeepSeek Harness (DeepSeek agent); the diff is one environment assignment and its comment.

Checklist

  • Based on current main (94c3c5f) and merges cleanly.
  • One topic: the build script's flags only.
  • No game data, keys or decryption: the change touches scripts/build-launcher.ps1 alone.
  • A new translator rule is in the contract table of docs/design.md — n/a, no translator change.

Fixes #349.

**@⁠erdemcisse** on GitHub · 2026-12-01 20:38 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/380) `erdemcisse:fix/build-launcher-path-with-spaces` → `main` · +6 −2 · 1 files · 72 commits · closed without merging ### What and why `scripts/build-launcher.ps1 -Package` cannot build the layer when the checkout or the user profile sits under a path with a space in it (`C:\Users\John Smith\Downloads\foxhound`), reported in #349. `cargo` splits `RUSTFLAGS` at every space and has no quoting, so the two `--remap-path-prefix` flags and `-C target-cpu=x86-64-v3` reach the compiler in pieces: ``` error: --remap-path-prefix must contain '=' between FROM and TO ``` which the script reports as `the layer did not build`. `CARGO_ENCODED_RUSTFLAGS` carries the same flags separated by U+001F instead — a character no Windows path can hold — so each flag arrives whole, and nothing changes on a path without spaces (the value is set and removed inside the same block). ### Tested No MSVC toolchain on this machine, so the check is the flags the script hands over, with a stand-in `cargo` that behaves like the real one (splits `RUSTFLAGS` at spaces, splits `CARGO_ENCODED_RUSTFLAGS` at U+001F, `CARGO_ENCODED_RUSTFLAGS` winning) and passes the result to a real `rustc 1.98.1 --print sysroot`. Checkout in `...\_pr_work\pr space test\foxhound`. Before (this branch's parent, unchanged script): ``` cargo-stub: RUSTFLAGS set cargo-stub: rustc argv = [--remap-path-prefix=C:\Users\CISSE=~] [--remap-path-prefix=C:\Users\CISSE\Downloads\_pr_work\pr] [space] [test\foxhound=.] [-C] [target-cpu=x86-64-v3] error: --remap-path-prefix must contain '=' between FROM and TO cargo-stub: rustc exit 1 the layer did not build ``` Real `cargo` 1.98.1 in the same folder fails the same way (its first `rustc` probe): ``` error: --remap-path-prefix must contain '=' between FROM and TO ... (exit code: 1) the layer did not build ``` After (`.\scripts\build-launcher.ps1 -Package`, same folder): ``` built ...\target\launcher\Foxhound.exe cargo-stub: CARGO_ENCODED_RUSTFLAGS set cargo-stub: rustc argv = [--remap-path-prefix=C:\Users\CISSE=~] [--remap-path-prefix=C:\Users\CISSE\Downloads\_pr_work\pr space test\foxhound=.] [-C] [target-cpu=x86-64-v3] C:\Users\CISSE\.rustup\toolchains\1.98.1-x86_64-pc-windows-gnu cargo-stub: rustc exit 0 ``` The run then stops at `Copy-Item ...\target\dist\dist\victory.exe` because the stand-in built nothing — the point of the check is that the build step itself now gets valid flags. `[System.Management.Automation.Language.Parser]::ParseFile` reports no syntax error in the edited script. Not run here: a full `-Package` build (needs MSVC, and the release build is minutes long); a maintainer's run on a normal path is unchanged by this diff, and a run on a spaced path is the case this fixes. GPUs tested: n/a (build script, no GPU involved). AI-assisted: yes — written and tested with DeepSeek Harness (DeepSeek agent); the diff is one environment assignment and its comment. ### Checklist - [x] Based on current `main` (`94c3c5f`) and merges cleanly. - [x] One topic: the build script's flags only. - [x] No game data, keys or decryption: the change touches `scripts/build-launcher.ps1` alone. - [ ] A new translator rule is in the contract table of `docs/design.md` — n/a, no translator change. Fixes #349.
`cargo build` splits RUSTFLAGS at every space and cannot quote, so with a
checkout under `C:\Users\John Smith\Downloads\foxhound` - or a profile whose
name holds a space - the compiler is handed `--remap-path-prefix=C:\Users\John`
and `Smith=~` separately and stops with

    error: --remap-path-prefix must contain '=' between FROM and TO

which `-Package` reports as "the layer did not build". CARGO_ENCODED_RUSTFLAGS
carries the same flags separated by U+001F, a character no path can hold, so
each flag reaches the compiler whole. Costs nothing on a path without spaces.

Reported in #349.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 20:40:53 +00:00
Author
Owner

@⁠deltaxdr on GitHub · 2026-12-02 01:37 UTC · original · approved these changes

good work, i've just hit the same problem while debugging

**@⁠deltaxdr** on GitHub · 2026-12-02 01:37 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/380#pullrequestreview-6143319952) · **approved these changes** good work, i've just hit the same problem while debugging
Author
Owner

@⁠readmet3xt-lab on GitHub · 2026-12-02 01:48 UTC · original

Thank you, this fixes a real stop for anyone whose checkout or user folder has a space in its path. The same change is in the candidate for the next release and will be credited to you in its notes. We'll close this when that release is published.

**@⁠readmet3xt-lab** on GitHub · 2026-12-02 01:48 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/380#issuecomment-7332135820) Thank you, this fixes a real stop for anyone whose checkout or user folder has a space in its path. The same change is in the candidate for the next release and will be credited to you in its notes. We'll close this when that release is published.
github-bot closed this pull request 2026-12-02 07:54:31 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.