Skip to content

fix(mo): preserve smart single quotes in the Windows launcher - #2022

Open
r266-tech wants to merge 2 commits into
tw93:windowsfrom
r266-tech:codex/windows-launcher-smart-quotes
Open

r266-tech wants to merge 2 commits into
tw93:windowsfrom
r266-tech:codex/windows-launcher-smart-quotes

Conversation

@r266-tech

@r266-tech r266-tech commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

The native mo.exe launcher builds a single-quoted PowerShell command but only escapes ASCII apostrophes. An install path such as O’Brien therefore ends the script-path literal early; smart single quotes in arguments can also change the values received by the script.

Escape U+2018, U+2019, U+201A and U+201B by doubling them, alongside ASCII apostrophes. Keep typographic double quotes unchanged: they are ordinary data inside this single-quoted literal. The generated .cmd launcher already uses -File and needs no change.

The regression builds and executes the real native launcher from each quote-bearing directory, checks argument bytes through a base64-encoded JSON fixture, and checks the script's exit code. It failed for all four Unicode single quotes before the fix and passes afterwards. The Go regression also checks that double quotes remain unchanged.

Validation on macOS arm64 (Go 1.24.6, the repository toolchain; also checked with Go 1.27.4):

  • go test ./cmd/... passes.
  • GOOS=windows go build ./cmd/... and GOOS=windows go vet ./cmd/... pass.
  • The CI-pinned golangci-lint v2.12.2 reports zero issues with GOOS=windows and Go 1.24.6. Its importer cannot decode the host Go 1.27 export format, so that initial setup failure is retained separately.
  • Pester 6.2.0 with PowerShell 7.7.0: the five new native-launcher cases pass (ASCII apostrophe control plus the four Unicode single quotes); the four Unicode cases fail on the original implementation.
  • Eight independent launcher-process round trips pass, including adjacent mixed quotes, double-quote paths, empty arguments, whitespace, newlines and the script exit code.

The incident ledger records #2021 and the new catchers against the fix commit. Its local audit passes with commit hashes shape-checked because the checkout is shallow.

Windows CI has now passed on head 7af8a516:

  • Windows PowerShell 5.1.26100.33648: 991 Pester tests passed, 0 failed, 0 skipped, 0 not run.
  • PowerShell 7.6.9: 991 Pester tests passed, 0 failed, 0 skipped, 0 not run.
  • All three Go command packages pass natively on Windows with Go 1.24.6.
  • All five PR checks succeeded: both test hosts, Format & Lint, Build, and Security Checks.

No real-PC e2e, Scoop/winget installation or reporter-machine acceptance has been performed.

Refs #2021.

PowerShell accepts U+2018 through U+201B as single-quote delimiters.
Double them when constructing literal script paths and arguments, while
preserving smart double quotes. Exercise the actual native launcher and
check both argument contents and its child script exit code.

Install-tier verification: full Go tests on macOS, Windows cross-build and
go vet, Pester 6.2.0 native launcher cases with PowerShell 7.7.0 on macOS,
and eight independent launcher-process round trips passed. The regression
fails on the original implementation. Native Windows PowerShell 5.1,
full Windows Pester and real-PC e2e remain unverified.

Refs tw93#2021.
@r266-tech
r266-tech marked this pull request as ready for review November 17, 2026 12:57
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.

1 participant