Skip to content

[#693] Fix Windows scripts for install paths with spaces and parentheses#671

Open
vharseko wants to merge 4 commits into
OpenIdentityPlatform:masterfrom
vharseko:issues/windows-tmpdir-quoting
Open

[#693] Fix Windows scripts for install paths with spaces and parentheses#671
vharseko wants to merge 4 commits into
OpenIdentityPlatform:masterfrom
vharseko:issues/windows-tmpdir-quoting

Conversation

@vharseko

@vharseko vharseko commented Jul 2, 2026

Copy link
Copy Markdown
Member

Fixes #693

Two quoting defects in the Windows scripts break any install directory containing spaces and/or parentheses — including the default MSI locations C:\Program Files (x86)\OpenDJ (x86) and C:\Program Files\OpenDJ.

1. Unquoted java.io.tmpdir

_script-util.bat appends the temp-dir Java argument without quotes:

set OPENDJ_JAVA_ARGS=%OPENDJ_JAVA_ARGS% -Djava.io.tmpdir=%OPENDJ_TMP_DIR%

With spaces in the path the argument splits and the CheckJVMVersion probe fails; setup.bat and every tool abort with "The detected Java version could not be used…". Reproduced in CI by installing the released 5.1.1 MSI into its default directory (failing job). Fixed by quoting the value.

2. Classpath building breaks on parentheses

_script-util.bat passed unquoted paths to setcp.bat, and setcp.bat compared arguments with if ""%1""=="""". The argument-joining hack survived spaces, but a parenthesis in the path — (x86) — breaks the cmd parser with "… was unexpected at this time", so setup.bat exits with 255 (failing job). Fixed by quoting the setcp.bat arguments at the three call sites and switching setcp.bat to %~1 with quoted comparisons.

Both defects date back to the original scripts and affect every delivery (zip and MSI) installed into a path with spaces/parentheses.

…aces)

_script-util.bat appends -Djava.io.tmpdir=%OPENDJ_TMP_DIR% to OPENDJ_JAVA_ARGS
without quotes, so in any install directory containing spaces (for example
C:\Program Files (x86)\OpenDJ) the CheckJVMVersion probe - and with it setup
and every other command-line tool - fails with "The detected Java version
could not be used with the set of Java arguments".

Quote the value: -Djava.io.tmpdir="%OPENDJ_TMP_DIR%".
@vharseko vharseko requested a review from maximthomas July 2, 2026 18:36
vharseko added a commit to vharseko/OpenDJ that referenced this pull request Jul 2, 2026
Drop the OPENDJ=C:\opendj override so the MSI test exercises the default install directory (C:\Program Files (x86)\OpenDJ), which contains spaces - covering the java.io.tmpdir quoting fix merged from PR OpenIdentityPlatform#671.
…cp.bat)

_script-util.bat passed unquoted paths to setcp.bat, and setcp.bat compared
arguments with if ""%1""=="""". The argument-joining hack survived spaces, but
a parenthesis in the path (C:\Program Files (x86)\OpenDJ - the default MSI
directory) breaks the cmd parser with "... was unexpected at this time", so
setup.bat and every tool exit with 255.

Quote the setcp.bat arguments at the three call sites and switch setcp.bat to
%~1 with quoted comparisons.
@vharseko vharseko changed the title Fix unquoted java.io.tmpdir in Windows scripts (install paths with spaces) Fix Windows scripts for install paths with spaces and parentheses Jul 3, 2026
@vharseko vharseko requested a review from maximthomas July 3, 2026 09:55
vharseko added 2 commits July 3, 2026 16:33
…e "%VAR%" == "" comparisons

After -Djava.io.tmpdir="%OPENDJ_TMP_DIR%" is appended, OPENDJ_JAVA_ARGS
contains embedded quotes, and the subsequent if "%OPENDJ_JAVA_ARGS%" == ""
checks blow up the cmd parser ('...\tmp"" was unexpected at this time', every
tool exits 255) regardless of whether the install path has spaces. Compare
with "if defined", which does not expand the value.
The tmp-cleanup block expands %OPENDJ_TMP_DIR% unquoted inside a ( ) compound statement, so a parenthesis in the install path - C:\Program Files (x86)\OpenDJ - terminates the block at parse time and start-ds fails; the Windows service then dies with a service-specific error -1 while setup (which never runs this block) succeeds. Quote the three path expansions.
@vharseko vharseko changed the title Fix Windows scripts for install paths with spaces and parentheses [#693] Fix Windows scripts for install paths with spaces and parentheses Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows scripts fail when OpenDJ is installed into a path with spaces or parentheses (default MSI locations)

2 participants