Skip to content

Commit 24b2c83

Browse files
author
Craig Perkins
committed
Tighten comments on the home-discovery fix and CI guard
Make the rem comments in the four .bat files point directly at the line that follows (why the trailing-backslash strip is needed) rather than re-explaining the whole bug, and shorten the CI-step comment to what the step does. Signed-off-by: Craig Perkins <cwperks@amazon.com>
1 parent b8deb19 commit 24b2c83

5 files changed

Lines changed: 13 additions & 21 deletions

File tree

‎.github/workflows/plugin_install.yml‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,11 @@ jobs:
6868
jdk-version: 21
6969

7070
- name: Verify demo config script locates OpenSearch home on Windows
71-
# Regression guard for #6023: the tools/*.bat parent-directory walk used
72-
# %~dpI on a path ending in "\." which does not ascend, so the script
73-
# exited non-zero and OpenSearch failed to start on Windows with no
74-
# error output. Run the script natively under cmd.exe (unlike the
75-
# bash-invoked path in start-opensearch), with OPENSEARCH_HOME unset so
76-
# the home-discovery loop is exercised. The -s flag makes an
77-
# already-configured opensearch.yml a benign exit 0 (start-opensearch
78-
# already ran the installer), while a home-discovery failure still
79-
# exits non-zero from setBaseDir - which is exactly what we guard.
71+
# Regression guard for #6023: run the demo installer natively under
72+
# cmd.exe (start-opensearch invokes it via bash, which hid the bug) with
73+
# OPENSEARCH_HOME unset, so the home-discovery loop must resolve it. -s
74+
# makes an already-configured opensearch.yml exit 0; a discovery failure
75+
# still exits non-zero.
8076
if: ${{ runner.os == 'Windows' }}
8177
shell: cmd
8278
run: |

‎tools/audit_config_migrater.bat‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ if defined OPENSEARCH_HOME goto find_home_done
66
set "OPENSEARCH_HOME=%DIR%"
77
:find_home
88
if exist "%OPENSEARCH_HOME%lib\opensearch-*.jar" goto find_home_done
9-
rem Strip the trailing backslash before expanding the parent, otherwise
10-
rem %%~dpI on a path ending in "\." resolves to the same directory and the
11-
rem loop never ascends (breaks OpenSearch startup on Windows, silently).
9+
rem Strip the trailing "\" first: %%~dpI of "...\dir\." returns "...\dir\"
10+
rem (no ascent), so the loop would never terminate. See #6023.
1211
for %%I in ("%OPENSEARCH_HOME:~0,-1%") do set "PARENT=%%~dpI"
1312
if /I "%PARENT%" == "%OPENSEARCH_HOME%" (
1413
echo Could not locate OpenSearch home. Set OPENSEARCH_HOME manually. 1>&2

‎tools/hash.bat‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ if defined OPENSEARCH_HOME goto find_home_done
66
set "OPENSEARCH_HOME=%DIR%"
77
:find_home
88
if exist "%OPENSEARCH_HOME%lib\opensearch-*.jar" goto find_home_done
9-
rem Strip the trailing backslash before expanding the parent, otherwise
10-
rem %%~dpI on a path ending in "\." resolves to the same directory and the
11-
rem loop never ascends (breaks OpenSearch startup on Windows, silently).
9+
rem Strip the trailing "\" first: %%~dpI of "...\dir\." returns "...\dir\"
10+
rem (no ascent), so the loop would never terminate. See #6023.
1211
for %%I in ("%OPENSEARCH_HOME:~0,-1%") do set "PARENT=%%~dpI"
1312
if /I "%PARENT%" == "%OPENSEARCH_HOME%" (
1413
echo Could not locate OpenSearch home. Set OPENSEARCH_HOME manually. 1>&2

‎tools/install_demo_configuration.bat‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ if defined OPENSEARCH_HOME goto find_home_done
77
set "OPENSEARCH_HOME=%DIR%"
88
:find_home
99
if exist "%OPENSEARCH_HOME%lib\opensearch-*.jar" goto find_home_done
10-
rem Strip the trailing backslash before expanding the parent, otherwise
11-
rem %%~dpI on a path ending in "\." resolves to the same directory and the
12-
rem loop never ascends (breaks OpenSearch startup on Windows, silently).
10+
rem Strip the trailing "\" first: %%~dpI of "...\dir\." returns "...\dir\"
11+
rem (no ascent), so the loop would never terminate. See #6023.
1312
for %%I in ("%OPENSEARCH_HOME:~0,-1%") do set "PARENT=%%~dpI"
1413
if /I "%PARENT%" == "%OPENSEARCH_HOME%" (
1514
echo Could not locate OpenSearch home. Set OPENSEARCH_HOME manually. 1>&2

‎tools/securityadmin.bat‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ if defined OPENSEARCH_HOME goto find_home_done
66
set "OPENSEARCH_HOME=%DIR%"
77
:find_home
88
if exist "%OPENSEARCH_HOME%lib\opensearch-*.jar" goto find_home_done
9-
rem Strip the trailing backslash before expanding the parent, otherwise
10-
rem %%~dpI on a path ending in "\." resolves to the same directory and the
11-
rem loop never ascends (breaks OpenSearch startup on Windows, silently).
9+
rem Strip the trailing "\" first: %%~dpI of "...\dir\." returns "...\dir\"
10+
rem (no ascent), so the loop would never terminate. See #6023.
1211
for %%I in ("%OPENSEARCH_HOME:~0,-1%") do set "PARENT=%%~dpI"
1312
if /I "%PARENT%" == "%OPENSEARCH_HOME%" (
1413
echo Could not locate OpenSearch home. Set OPENSEARCH_HOME manually. 1>&2

0 commit comments

Comments
 (0)