fix(platform): shell-quote paths in all RunShell callsites (Windows spaces)#28
Merged
dipto0321 merged 1 commit intoJun 30, 2026
Conversation
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.
e131e49 to
05b4ece
Compare
|
✔️ 05b4ece - Conventional commits check succeeded. |
15 tasks
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>
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.
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- [ ]
revertChecklist
fix(platform): subject)make cilocally and it passesdocs/, inline godoc)Scope notes / things reviewers may want to look at
Screenshots / output