install.bat: fix parens-in-username breaking OTP path expansion#1826
Open
hanuele wants to merge 1 commit into
Open
install.bat: fix parens-in-username breaking OTP path expansion#1826hanuele wants to merge 1 commit into
hanuele wants to merge 1 commit into
Conversation
On Windows, when %USERPROFILE% contains parentheses (e.g. `PeterLinder(3Txpert)`), four lines in install.bat fail because %tmp_dir% expands inside `if (...)` cmd-batch blocks at parse time — the embedded close-paren terminates the if-block early, producing "syntactisch nicht verarbeitbar" / "syntactically unprocessable" errors before the OTP download even begins. Two complementary fixes match the existing patterns: - Quote the path argument in curl.exe / del (lines 148, 205) — the Elixir-side curl at line 192 was already correctly quoted; this restores symmetry with the OTP-side calls. - Use delayed expansion `!tmp_dir!\!otp_zip!` (lines 150, 194) — both are inside if-blocks where %tmp_dir% would expand at parse time. Delayed expansion expands at execution time, after the parser has already matched the if-block parens. Verified locally on a Windows account with parenthesized username: unpatched `install.bat elixir@latest otp@latest` fails before OTP download; patched version completes both downloads cleanly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
On Windows, when
%USERPROFILE%contains parentheses (e.g.C:\Users\PeterLinder(3Txpert)),install.batfails on the OTP download/unpack step with a German"syntactisch nicht verarbeitbar"/ English"... was unexpected at this time"cmd-batch parse error — before any download begins.Root cause: four lines in
install.batuse unquoted%tmp_dir%insideif (...)blocks. Because cmd-batch performs%var%expansion at parse time (not execution time), the close-paren embedded in%tmp_dir%terminates the surroundingifblock prematurely. The cmd parser then sees athen-clause without an opening paren.This PR applies two patterns already present elsewhere in the file:
curl.exe(line 148) anddel /f /q(line 205) calls. The Elixir-side curl at line 192 was already correctly quoted — this restores symmetry with the OTP-side calls.!tmp_dir!\!otp_zip!) at the twoecho unpacking …lines (150, 194). Delayed expansion happens at execution time, after the parser has already matched the if-block parens.The change is minimal (4 lines) and entirely additive: every modified line was either missing quotes or using the wrong expansion form; no existing behavior changes for usernames without parentheses.
Reproduction
On a Windows account with
(in the username:Before patch: errors at the OTP curl/echo step before the download starts.
After patch: both downloads complete cleanly; OTP and Elixir install as expected.
Test plan
install.bat elixir@latest otp@latestruns cleanly underPeterLinder(3Txpert)(parenthesized) — both OTP and Elixir downloaded, unpacked, and version-checked.main: 4 lines changed, no other changes.🤖 Generated with Claude Code