Skip to content

Fix install.bat failing when the user profile path contains a space - #1854

Merged
josevalim merged 1 commit into
elixir-lang:mainfrom
djantea:fix-install-bat-userprofile-spaces
Sep 23, 2026
Merged

josevalim merged 1 commit into
elixir-lang:mainfrom
djantea:fix-install-bat-userprofile-spaces

Conversation

@djantea

@djantea djantea commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Problem

public/install.bat creates its temp directory with an unquoted path:

set "root_dir=%USERPROFILE%\.elixir-install"
set "tmp_dir=%root_dir%\tmp"
mkdir %tmp_dir% 2>nul

When %USERPROFILE% contains a space — e.g. C:\Users\Jane Doe — cmd treats this as two arguments to mkdir and creates the wrong directories. The resulting error is swallowed by 2>nul, so the script carries on with a tmp_dir that does not exist.

The first download then fails with an error that gives no hint about the real cause:

downloading https://github.com/erlang/otp/releases/download/OTP-29.0.3/otp_win64_29.0.3.zip...
curl: (23) client returned ERROR on write of 16384 bytes

curl: (23) is CURLE_WRITE_ERROR — the transfer itself succeeded but the local write failed, because curl.exe -fsSLo "%tmp_dir%\%otp_zip%" (correctly quoted) points into a directory that was never created.

Fix

Quote the path, matching the rest of the file.

mkdir was the only unquoted use of these path variables in the script — every other reference (curl.exe -fsSLo, Expand-Archive, del, rmdir, cd /d) is already quoted, which is why this single line was enough to break the install for any profile with a space in the name.

Reproduction

On a Windows account whose profile path contains a space:

curl.exe -fsSO https://elixir-lang.org/install.bat
.\install.bat elixir@1.20.2 otp@29.0.3

Fails as above. After manually running mkdir "$env:USERPROFILE\.elixir-install\tmp", the same command completes successfully.

`mkdir %tmp_dir% 2>nul` is unquoted, so when %USERPROFILE% contains a
space cmd splits it into two arguments and creates the wrong directories.
The error is swallowed by 2>nul, so the script continues with a tmp
directory that was never created, and the download then fails with a bare
`curl: (23) client returned ERROR on write of 16384 bytes`.

Every other use of the path variables in this file is already quoted.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@josevalim
josevalim merged commit a4bf840 into elixir-lang:main Sep 23, 2026
@josevalim

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

@djantea
djantea deleted the fix-install-bat-userprofile-spaces branch September 23, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants