fix(install.ps1): use string concatenation instead of interpolation w… - #201
Merged
Conversation
…/ parens PS 5.1 still failing on line 381 even after the previous fix: At C:\Users\TTT\install.ps1:381 char:51 + Write-Host "`r $Pct% ($WrittenMB MB / $TotalMB MB) @ ... + ~~ Unexpected token 'MB' in expression or statement. Root cause: PowerShell 5.1's tokenizer treats the opening paren inside a double-quoted string followed by a variable as a potential subexpression start, and when the contents don't form a valid subexpression, the parser falls over. The pattern ($Varname Text) is the specific trigger. The previous fix used native string interpolation with the suspect pattern still embedded: Write-Host "`r $Pct% ($WrittenMB MB / $TotalMB MB) @ $Rate MB/s" -NoNewline This commit replaces it with explicit string concatenation — no parens inside the string at all: $ProgressLine = "`r " + $Pct + "% " + $WrittenMB + " MB / " + $TotalMB + " MB @ " + $Rate + " MB/s" Write-Host $ProgressLine -NoNewline Verified: - PowerShell 7 parser: PARSE OK (0 errors). - Static scan for suspect '(<dollar>' patterns in string literals: 0 found. - install.ps1 -Help still runs cleanly. Lesson learned: stop hand-writing PowerShell string interpolation that contains parentheses. Use concatenation, or pre-compute variables and reference them with simple $Varname interpolation (no parens).
Nan0pk
enabled auto-merge
June 30, 2026 12:33
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.
…/ parens
PS 5.1 still failing on line 381 even after the previous fix:
At C:\Users\TTT\install.ps1:381 char:51
Unexpected token 'MB' in expression or statement.
Root cause: PowerShell 5.1's tokenizer treats the opening paren inside a double-quoted string followed by a variable as a potential subexpression start, and when the contents don't form a valid subexpression, the parser falls over. The pattern ($Varname Text) is the specific trigger.
The previous fix used native string interpolation with the suspect pattern still embedded:
Write-Host "`r $Pct% ($WrittenMB MB / $TotalMB MB) @ $Rate MB/s" -NoNewline
This commit replaces it with explicit string concatenation — no parens inside the string at all:
$ProgressLine = "`r " + $Pct + "% " + $WrittenMB + " MB / " + $TotalMB + " MB @ " + $Rate + " MB/s"
Write-Host $ProgressLine -NoNewline
Verified:
Lesson learned: stop hand-writing PowerShell string interpolation that contains parentheses. Use concatenation, or pre-compute variables and reference them with simple $Varname interpolation (no parens).
What Does This Change?
A clear description of what this PR changes and why.
Motivation
Why is this change needed? Link to the issue it resolves (e.g.,
Closes #123)or explain the problem it solves.
Type of Change
Testing
cargo test --workspacepassescargo clippy --workspace --all-targets -- -D warningspassescargo fmt --all -- --checkpassespwsh ./tools/validate-repo.ps1passespython3 tools/validate-evidence.pypasses (Dragnet gate)Evidence (Dragnet)
verified = true, it commits theacceptance
transcriptandpython3 tools/dragnet.py --observeis GREENwith zero
pendingledger rows for that milestone. (Seedocs/dragnet-protocol.md.)Documentation
Documentation updates are required for changes to behavior, defaults,
policy, boot/update flow, kernel fragments, recipes, or service behavior.
docs/IMPLEMENTATION_STATUS.mdupdatedIf no doc update is needed, explain why:
Checklist
CONTRIBUTING.mdone adaptive policy owner, explainable behavior)
SECURITY.mdand relevantADRs are updated