Skip to content

fix(platform): shell-quote paths in all RunShell callsites (Windows spaces)#28

Merged
dipto0321 merged 1 commit into
mainfrom
fix/platform/shell-quote-paths-in-all-runshell-callsites-windows-spaces
Jun 30, 2026
Merged

fix(platform): shell-quote paths in all RunShell callsites (Windows spaces)#28
dipto0321 merged 1 commit into
mainfrom
fix/platform/shell-quote-paths-in-all-runshell-callsites-windows-spaces

Conversation

@dipto0321

Copy link
Copy Markdown
Owner

Summary

Linked issues

Closes #25

Type of change

  • fix — see the title; check the matching box below
    - [ ] feat
    - [ ] docs
    - [ ] style
    - [ ] refactor
    - [ ] perf
    - [ ] test
    - [ ] build
    - [ ] ci
    - [ ] chore
    - [ ] revert

Checklist

  • Title follows Conventional Commits (fix(platform): subject)
  • I ran make ci locally and it passes
  • I added or updated tests for the change
  • I updated relevant docs (README, docs/, inline godoc)
  • No new linter warnings
  • If breaking: I documented the migration path in the PR body and updated CHANGELOG.md

Scope notes / things reviewers may want to look at

Screenshots / output

The detector layer has been correctly calling platform.QuotePath on any
filesystem path embedded in a shell script (the only callsite is
internal/detector/nvm.go which sources ~/.nvm/nvm.sh). However, the
QuotePath helper itself had only three smoke tests covering one input
each, leaving several cross-platform regressions undetected:

  - Windows backslash-escape behavior was untested (no test exercised a
    Windows-style path like C:\\Program Files\\nodejs).
  - Unix shell metacharacters that QuotePath protects against were not
    table-driven ($, `, |, <, >, embedded ").
  - The cross-platform distinction in unsafe-char sets was implicit; a
    future refactor that swapped the two would not be caught by tests
    on a single OS.
  - End-to-end behavior (a quoted path actually round-tripping through
    the shell) was not exercised.

This change adds TestQuotePathTable (table-driven, split into unix and
Windows case sets so the same test runs on all three CI OSes and the
expected output is unambiguous per OS) and TestQuotePathRoundTrip (which
shells out via RunShellScript and printf to confirm quoted paths survive
an actual bash round-trip). It also adds a doc comment on RunShellScript
making it explicit that callers must pass paths through QuotePath before
embedding them in the script string.

No production code in QuotePath itself was changed -- the implementation
was already correct; the gap was test coverage and discoverability of
the contract. Closes #25.
@dipto0321 dipto0321 force-pushed the fix/platform/shell-quote-paths-in-all-runshell-callsites-windows-spaces branch from e131e49 to 05b4ece Compare June 30, 2026 11:20
@cocogitto-bot

cocogitto-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

✔️ 05b4ece - Conventional commits check succeeded.

@dipto0321 dipto0321 merged commit b32cc10 into main Jun 30, 2026
10 checks passed
@dipto0321 dipto0321 deleted the fix/platform/shell-quote-paths-in-all-runshell-callsites-windows-spaces branch June 30, 2026 11:22
dipto0321 added a commit that referenced this pull request Jul 1, 2026
…ep (#33)

The CHANGELOG was missing Phase 6 bullets for PRs #28 (QuotePath
for paths with spaces), #29 (interrupted-upgrade sentinel + --from
restore), and #30 (system-node classifier with warnings). It also
had a duplicate `### Added` header from a prior merge and still
listed the scripts/issue-workflow.sh script that PR #32 deleted.

The README's Project status table said "Phase 1-5 OK" with no
mention of Phase 6 cross-platform polish. The Phase 7 status
(GoReleaser config + brew/scoop taps + npm wrapper) was also
missing.

CHANGELOG.md:
- Single Added / Changed / Removed block under [Unreleased] (was
  two Added blocks).
- Add Phase 6 bullets: system-node classifier (#30), interrupted-
  upgrade sentinel + replay (#29), QuotePath for paths with
  spaces (#28).
- Drop the stale `scripts/issue-workflow.sh` bullet; add a Removed
  entry pointing at the squash-merged PR #32 commit for context.

README.md:
- Project status table marks Phase 6 complete, with PR refs and
  a note that Phase 7 (issue #17) is the remaining work blocking
  the v1.0.0 tag.
- Trailing paragraph updated to reflect Phase 6 in the phase order.

Refs #18

Co-authored-by: dipto0321 <dipto@local>
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.

fix(platform): shell-quote paths in all RunShell callsites (Windows spaces)

1 participant