Fix: health_check.bat no longer splits a Windows install path that co…#18178
Open
wallner-avat wants to merge 1 commit into
Open
Fix: health_check.bat no longer splits a Windows install path that co…#18178wallner-avat wants to merge 1 commit into
wallner-avat wants to merge 1 commit into
Conversation
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.
…ntains a space
Fixes #18177
Description
Symptom
On Windows, when IoTDB is located under a path that contains a space (e.g.
C:\Program Files\iotdb), the health-check tool's Installation Environment(Directory Access) check splits directory paths at the space. It:C:\Program, and"C:\Program" has write permissionfollowed by"Files\...\ext\pipe" has write permission— instead of one line for the real directory.Reproduced on 2.0.8 and current
master(identical code). Present since the tool was added (#12325); not addressed by #12435 (launch scripts) or #12450 (permission-detection logic).Root cause
In
scripts/tools/windows/ops/health_check.bat,:local_dirs_checkjoins the directory variables intospacedirswith spaces and iterates them withfor %%a in (%spacedirs%). Thefor ... in (set)form tokenizes on spaces (and,/;), so a path containing a space is split into two tokens. The innerfor %%b/%%cloops already preserve spaces for the;/,multi-dir separators (via the"!var:;=" "!"technique), but the outer space-join defeats that.Separately,
%%c(fromfor %%c in ("...")) carries its surrounding quotes, somkdir "%%c"expands tomkdir ""C:\Program Files\...""— a doubly-quoted path the argument parser re-splits, recreating the stray directory even after theouter loop is fixed.
Fix
Two coordinated changes in
:local_dirs_check, both required:%%~a, so the outer loop yields exactly one entry per configured variable with spaces intact.%%~cfor every filesystem operation and result message (mkdir,if not exist, and the temp-file write/exist/delete), so they receive a single correctly-quoted path. Thefor %%c in (...)loop variable itself isunchanged.
A short
@REMin:local_dirs_checkdocuments why the list is quoted.Behavior:
;/,-separated multi-directory values still split correctly.Alternatives considered:
for /fand explicit,/;delimiters — a larger change with no functional advantage; the quote-preserving approach is minimal and reuses the technique already present in the inner loops.which is common on Windows where
C:\Program Filesis the natural location.Testing
No automated harness exists for the batch tool, so verified manually on Windows:
C:\Program Files\iotdb, runhealth_check.bat -o local: before → stray emptyC:\Programcreated + split/garbled Directory Access lines; after → no stray directory, one clean line per directory (e.g.C:\Program Files\iotdb\ext\pipe has write permission).;/,-separateddn_data_dirs: still enumerated correctly.This PR has:
Key changed/added classes (or packages if there are too many classes) in this PR
scripts/tools/windows/ops/health_check.bat—:local_dirs_checkroutine (Windows batch script; no Java classes changed).