Skip to content

Commit 6a501cc

Browse files
authored
install.bat: fix parens-in-username breaking OTP path expansion (#1826)
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.
1 parent 46bcf52 commit 6a501cc

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

install.bat

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ if not exist "%otp_dir%\bin" (
145145

146146
set otp_url=https://github.com/erlang/otp/releases/download/OTP-!otp_version!/%otp_zip%
147147
echo downloading !otp_url!...
148-
curl.exe -fsSLo %tmp_dir%\%otp_zip% "!otp_url!" || exit /b 1
148+
curl.exe -fsSLo "%tmp_dir%\%otp_zip%" "!otp_url!" || exit /b 1
149149

150-
echo unpacking %tmp_dir%\%otp_zip%
150+
echo unpacking !tmp_dir!\!otp_zip!
151151
powershell -NoProfile -Command ^
152152
"$ErrorActionPreference='Stop';" ^
153153
"try {" ^
@@ -191,7 +191,7 @@ if not exist "%elixir_dir%\bin" (
191191
echo downloading !elixir_url!...
192192
curl.exe -fsSLo "%tmp_dir%\%elixir_zip%" "!elixir_url!" || exit /b 1
193193

194-
echo unpacking %tmp_dir%\%elixir_zip%
194+
echo unpacking !tmp_dir!\!elixir_zip!
195195
powershell -NoProfile -Command ^
196196
"$ErrorActionPreference='Stop';" ^
197197
"try {" ^
@@ -202,6 +202,6 @@ if not exist "%elixir_dir%\bin" (
202202
" Expand-Archive -LiteralPath '%tmp_dir%\%elixir_zip%' -DestinationPath '%elixir_dir%' -Force" ^
203203
" }" ^
204204
"} catch { Write-Error $_; exit 1 }"
205-
del /f /q %tmp_dir%\%elixir_zip%
205+
del /f /q "%tmp_dir%\%elixir_zip%"
206206
)
207207
goto :eof

0 commit comments

Comments
 (0)