apache / apache/iotdb

[Bug] health_check.bat creates a stray empty directory (e.g. C:\Program) when the install path contains a space

オープン 初心者向け
#18,177 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
6.4k
フォーク
1.2k
平均マージ
1日 23時間
マージ済み PR(30日)
115

説明

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/iotdb/issues) and found nothing similar.

### Version

Reproduced on **2.0.8** and current **master** (identical code). Present since the tool was introduced (#12325); not addressed by #12435 (launch scripts) or #12450 (permission-detection logic).

Environment:

- OS: Windows (reproduces wherever the install path contains a space)
- IoTDB: 2.0.8 and master

### Describe the bug and provide the minimal reproduce step

On Windows, if 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:

1. **creates a stray empty directory** such as `C:\Program`, and
2. prints garbled results - e.g. `"C:\Program" has write permission` followed by `"Files\...\ext\pipe" has write permission` - instead of one line for the real directory.

To reproduce:

1. Unzip/install IoTDB into a path containing a space, e.g. `C:\Program Files\iotdb` (or `C:\test dir\iotdb`).
2. Run `tools\windows\ops\health_check.bat -o local`.
3. Observe a stray empty `C:\Program` directory, and split/garbled lines in the Directory Access section.

Any configured directory under the spaced install path triggers it; the `ext/*` dirs (`pipe_lib_dir` / `udf_lib_dir` / `trigger_lib_dir`) hit it by default because they resolve to `%IOTDB_HOME%\ext\...`.

Affected file: `scripts/tools/windows/ops/health_check.bat`, routine `:local_dirs_check`.

Root cause:

`:local_dirs_check` joins the directory variables into `spacedirs` with **spaces** and iterates with `for %%a in (%spacedirs%)`. The `for ... in (set)` form tokenizes on spaces (and `,`/`;`), so a path containing a space is split into two
tokens. The inner `for %%b`/`%%c` loops already preserve spaces for the `;`/`,` multi-dir separators via the `"!var:;=" "!"` technique, but the outer space-join defeats that. Separately, `%%c` (from `for %%c in ("...")`) still carries its
surrounding quotes, so `mkdir "%%c"` expands to `mkdir ""C:\Program Files\...""` - a doubly-quoted path the argument parser re-splits.

### What did you expect to see?

Each configured directory is checked as a single path; no stray directory is created; the output has one clean line per directory.

### What did you see instead?

The tool splits directory paths at the space and creates a stray directory.

### Anything else?

The docs recommend a space-free install path, but the tool shouldn't *create stray directories* or emit corrupt output when that guidance isn't met - especially since Windows users frequently install under `C:\Program Files`. A minimal fix is
available (see PR).

### Are you willing to submit a PR?

- [x] I'm willing to submit a PR!

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

scripts/tools/windows/ops/health_check.bat から始め、:local_dirs_check ルーチンとそのディレクトリ反復処理に焦点を当てます。スペースを含むパスに IoTDB をインストールして再現し、その後、tools\windows\ops\health_check.bat -o local が設定された各ディレクトリを 1 つのパスとして報告し、余計なディレクトリを作成しないことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
shell
領域
operating-systems, tooling
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
78/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。